Browse Source

key command for options panel toggle

Petra Lamborn 3 years ago
parent
commit
3843f4d28a
1 changed files with 8 additions and 3 deletions
  1. 8
    3
      viz/app.R

+ 8
- 3
viz/app.R View File

@@ -112,7 +112,7 @@ ui <- fluidPage(
112 112
                  status_off = "primary",
113 113
                  value = TRUE)
114 114
   ),
115
-  absolutePanel(top = 40, right = 6, id="control2", title="Toggle panel",
115
+  absolutePanel(top = 40, right = 6, id="control2", title="Toggle pane(L)",
116 116
                 prettySwitch("controlswitch", value=TRUE, label = NULL,
117 117
                              slim = FALSE,
118 118
                                inline=TRUE, status="info",
@@ -348,8 +348,13 @@ server <- function(input, output) {
348 348
     updateMap()
349 349
   })
350 350
   observeEvent(input$controlswitch, ignoreInit = TRUE, {
351
-    shinyjs::toggleElement("mapcontrol", anim=TRUE,
352
-                           time = 0.5)
351
+    if (input$controlswitch) {
352
+      shinyjs::showElement("mapcontrol", anim=TRUE,
353
+                             time = 0.5)
354
+    } else {
355
+      shinyjs::hideElement("mapcontrol", anim=TRUE,
356
+                             time = 0.5)
357
+    }
353 358
   })
354 359
   observeEvent(input$mapinfobutton, ignoreInit = TRUE, {
355 360
     if (input$mapinfobutton) {