transfer from old repo
This commit is contained in:
parent
cfa4a5f9cc
commit
277e2b8cf3
1111 changed files with 83736 additions and 0 deletions
41
apps/shinyDAG-1.0.0/R/inputs.R
Normal file
41
apps/shinyDAG-1.0.0/R/inputs.R
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# A fancy selectizeInput for angles
|
||||
selectDegree <- function(
|
||||
inputId,
|
||||
label = "Degree",
|
||||
min = -180 + by,
|
||||
max = 180,
|
||||
by = 45,
|
||||
value = 0,
|
||||
...
|
||||
) {
|
||||
if (sign(min + (max - min)) != sign(by)) {
|
||||
by <- -by
|
||||
}
|
||||
choices <- seq(min, max, by)
|
||||
|
||||
selectizeInput(inputId, label = label, choices, selected = value, multiple = FALSE, ..., )
|
||||
}
|
||||
|
||||
|
||||
# A button group that toggles state and optionally allows one button to be active at a time
|
||||
buttonGroup <- function(inputId, options, btn_class = "btn-default", multiple = FALSE, aria_label = NULL) {
|
||||
btn_class <- paste("btn", paste(btn_class, collapse = " "))
|
||||
button_list <- purrr::imap(options, button_in_group, class = btn_class)
|
||||
selected <- shiny::restoreInput(inputId, default = "")
|
||||
tagList(
|
||||
singleton(tags$head(tags$script(src = "shinythingsButtonGroup.js"))),
|
||||
tags$div(
|
||||
class = "shinythings-btn-group btn-group",
|
||||
id = inputId,
|
||||
`data-input-id` = inputId,
|
||||
`data-active` = selected,
|
||||
`data-multiple` = as.integer(multiple),
|
||||
role = "group",
|
||||
button_list
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
button_in_group <- function(input_id, text, class = "btn btn-default") {
|
||||
tags$button(id = input_id, class = class, text)
|
||||
}
|
||||
Loading…
Reference in a new issue