mirror of
https://github.com/penpot/penpot.git
synced 2025-06-02 07:01:41 +02:00
🐛 Fix viewer querystring not being updated with zoom type
This commit is contained in:
parent
7bf4305269
commit
96b7fb7f12
1 changed files with 19 additions and 2 deletions
|
@ -253,6 +253,18 @@
|
||||||
|
|
||||||
;; --- Zoom Management
|
;; --- Zoom Management
|
||||||
|
|
||||||
|
(def update-zoom-querystring
|
||||||
|
(ptk/reify ::update-zoom-querystring
|
||||||
|
ptk/WatchEvent
|
||||||
|
(watch [_ state _]
|
||||||
|
(let [zoom-type (get-in state [:viewer-local :zoom-type])
|
||||||
|
route (:route state)
|
||||||
|
screen (-> route :data :name keyword)
|
||||||
|
qparams (:query-params route)
|
||||||
|
pparams (:path-params route)]
|
||||||
|
|
||||||
|
(rx/of (rt/nav screen pparams (assoc qparams :zoom zoom-type)))))))
|
||||||
|
|
||||||
(def increase-zoom
|
(def increase-zoom
|
||||||
(ptk/reify ::increase-zoom
|
(ptk/reify ::increase-zoom
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
|
@ -293,7 +305,10 @@
|
||||||
minzoom (min wdiff hdiff)]
|
minzoom (min wdiff hdiff)]
|
||||||
(-> state
|
(-> state
|
||||||
(assoc-in [:viewer-local :zoom] minzoom)
|
(assoc-in [:viewer-local :zoom] minzoom)
|
||||||
(assoc-in [:viewer-local :zoom-type] :fit))))))
|
(assoc-in [:viewer-local :zoom-type] :fit))))
|
||||||
|
|
||||||
|
ptk/WatchEvent
|
||||||
|
(watch [_ _ _] (rx/of update-zoom-querystring))))
|
||||||
|
|
||||||
(def zoom-to-fill
|
(def zoom-to-fill
|
||||||
(ptk/reify ::zoom-to-fill
|
(ptk/reify ::zoom-to-fill
|
||||||
|
@ -309,7 +324,9 @@
|
||||||
maxzoom (max wdiff hdiff)]
|
maxzoom (max wdiff hdiff)]
|
||||||
(-> state
|
(-> state
|
||||||
(assoc-in [:viewer-local :zoom] maxzoom)
|
(assoc-in [:viewer-local :zoom] maxzoom)
|
||||||
(assoc-in [:viewer-local :zoom-type] :fill))))))
|
(assoc-in [:viewer-local :zoom-type] :fill))))
|
||||||
|
ptk/WatchEvent
|
||||||
|
(watch [_ _ _] (rx/of update-zoom-querystring))))
|
||||||
|
|
||||||
(def toggle-zoom-style
|
(def toggle-zoom-style
|
||||||
(ptk/reify ::toggle-zoom-style
|
(ptk/reify ::toggle-zoom-style
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue