我可以在显示窗口外面绘制一个processingJS矩形吗?

时间:2017-05-31 23:31:27

标签: javascript canvas processing.js

我正在尝试使用processingJS在画布上绘制带有边界的“世界”。我希望主屏幕为黑色,边框周围有灰色。首先我试过了:

library(shiny)
library(shinydashboard)

# these must be unique and exist for every item
itemIds <- c(team = "#team", team2 = "#team2", user = "#user")

ui <- dashboardPage(
  dashboardHeader(
    dropdownMenu(type = "messages", badgeStatus = "success",
      messageItem("Support Team", "This is the content of a message.",
        time = "5 mins", href = itemIds[["team"]]
      ),
      messageItem("Support Team", "This is the content of another message.",
        time = "2 hours", href = itemIds[["team2"]]
      ),
      messageItem("New User", "Can I get some help?",
        time = "Today", href = itemIds[["user"]]
      )
    )
  ),
  dashboardSidebar(),
  dashboardBody(
    sliderInput("sld", "This is here so you know that other inputs are not affected by this workaround", 0, 100, 50),
    uiOutput("ui")
  )
)

server <- function(input, output, session) { 
  output$ui <- renderUI({
    hash <- getUrlHash()
    if (hash %in% itemIds) {
      paste("This is shown when", hash, "is clicked")
    }
  })
}

shinyApp(ui, server)

我的processingJS代码中的其他所有内容都运行正常,除此之外。我也尝试过:

View::make('location.of.template', ..)

这也不起作用。甚至可以在画布的直接显示区域之外绘制一个矩形吗? 非常感谢你!

1 个答案:

答案 0 :(得分:2)

没有。你不能在画布外画画。

你必须创建一个更大的画布并绘制它。

但是如果您只想绘制边框,那么您可以使用CSS或p5.dom库。