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
                  status_off = "primary",
112
                  status_off = "primary",
113
                  value = TRUE)
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
                 prettySwitch("controlswitch", value=TRUE, label = NULL,
116
                 prettySwitch("controlswitch", value=TRUE, label = NULL,
117
                              slim = FALSE,
117
                              slim = FALSE,
118
                                inline=TRUE, status="info",
118
                                inline=TRUE, status="info",
348
     updateMap()
348
     updateMap()
349
   })
349
   })
350
   observeEvent(input$controlswitch, ignoreInit = TRUE, {
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
   observeEvent(input$mapinfobutton, ignoreInit = TRUE, {
359
   observeEvent(input$mapinfobutton, ignoreInit = TRUE, {
355
     if (input$mapinfobutton) {
360
     if (input$mapinfobutton) {