Skip to content

Commit

Permalink
slider moves with button change
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Sep 29, 2024
1 parent b8cca0d commit 4e41306
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/rtable/render/pixi/line.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
price (get row col)]
(if (= 0 idx)
(do
(println "idx=0 price:" price "x: " x-center)
;(println "idx=0 price:" price "x: " x-center)
(.moveTo graphics x-center price))
(do
(println "idx: " idx " price:" price "x: " x-center)
;(println "idx: " idx " price:" price "x: " x-center)
(.lineTo graphics x-center price))
)))

Expand Down
37 changes: 23 additions & 14 deletions src/rtable/render/pixi/nav.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,30 @@
(defn nav
([state op]
(nav state op -1))
([state op new-end-idx]
(let [{:keys [end-idx row-count row-count-visible container]} @state
([state op new-end-idx-param]
(let [{:keys [end-idx row-count row-count-visible container slider]} @state
set-end-idx (fn [end-idx]
(swap! state assoc :end-idx end-idx))]
(swap! state assoc :end-idx end-idx))
end-idx-new (case op
:idx
new-end-idx-param
:begin
row-count-visible
:end
row-count
:prior
(max row-count-visible (- end-idx row-count-visible))
:next
(min row-count (+ end-idx row-count-visible)))]

(case op
:idx
(set-end-idx new-end-idx)
:begin
(set-end-idx row-count-visible)
:end
(set-end-idx row-count)
:prior
(set-end-idx (max row-count-visible (- end-idx row-count-visible)))
:next
(set-end-idx (min row-count (+ end-idx row-count-visible))))
(set-end-idx end-idx-new)
(adjust-visible state)

(let [slider-value (.-value slider)]
(println "slider value is: " slider-value "end-idx is: " end-idx-new)
(if (not (= slider-value end-idx-new))
(set! (.-value slider) end-idx-new)))

(.removeChildren ^Container container)
(pixi-render state))))

Expand Down Expand Up @@ -88,6 +95,8 @@
;(.addChild container bg)
;(.addChild container fill)
;(.addChild container slider)

(swap! state assoc :slider slider2)
;container
slider2)))

Expand Down

0 comments on commit 4e41306

Please sign in to comment.