Skip to content

Commit ae6b670

Browse files
committed
Fix button-nav buttons
1 parent 5004ffa commit ae6b670

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

resources/public/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
<div class="btn-zoom-container" style="position: relative;">
3434
<div class="btn-group btn-group-zoom" role="group" >
3535
<button type=button class="btn btn-secondary b-tooltip btn-zoom btn-zoom-in"
36-
title="Zoom In">+</button>
36+
title="Zoom In" id="zoom-in-btn">+</button>
3737
<button type=button class="btn btn-secondary b-tooltip btn-zoom btn-zoom-out"
38-
title="Zoom Out">-</button>
38+
title="Zoom Out" id="zoom-out-btn">-</button>
3939
<button type=button class="btn btn-secondary b-tooltip btn-zoom btn-zoom-fit"
40-
title="Fit to View">[&nbsp;]</button>
40+
title="Fit to View" id="fit-to-view-btn">[&nbsp;]</button>
4141
</div>
4242
</div>
4343
</nav>

src/matr_gui_clj/core.cljs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,31 @@
222222
[main-content]
223223
[modal]]
224224
(. js/document (getElementById "main-content-container")))
225+
226+
(defn zoom [f]
227+
(.zoom @cytoscape-instance
228+
#js{:level (f (.zoom @cytoscape-instance))
229+
:position (.position
230+
(.getElementById
231+
@cytoscape-instance
232+
"mainWorkspace"))}))
233+
234+
(defn zoom-in [] (zoom inc))
235+
236+
(defn zoom-out [] (zoom dec))
237+
238+
(defn fit-to-view [] (.fit @cytoscape-instance))
239+
240+
(defn load-event []
241+
(.addEventListener
242+
(.getElementById js/document "zoom-in-btn") "click" zoom-in)
243+
(.addEventListener
244+
(.getElementById js/document "zoom-out-btn") "click" zoom-out)
245+
(.addEventListener
246+
(.getElementById js/document "fit-to-view-btn") "click" fit-to-view))
247+
248+
(.addEventListener js/window "load" load-event false)
249+
225250
(defn on-js-reload []
226251
;; optionally touch your app-state to force rerendering depending on
227252
;; your application

src/matr_gui_clj/cytoscape.cljs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ node.prove-source {
136136
replace-head-syms
137137
print-str))
138138

139-
;; Added 03/04/20
140139
(defn latex->encoded-svg
141140
"Convert string of plain-text represented LaTeX into an svg file."
142141
[^String latex]

0 commit comments

Comments
 (0)