0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

🐛 Fix zoom in/out after fit or fill in viewer

This commit is contained in:
Andrés Moya 2022-01-21 17:00:51 +01:00 committed by Andrey Antukh
parent c3e37b0e04
commit b4bf6b9235
2 changed files with 11 additions and 8 deletions

View file

@ -72,6 +72,7 @@
- Fix default profile image generation issue [Taiga #2601](https://tree.taiga.io/project/penpot/issue/2601)
- Fix edit blur attributes for multiselection [Taiga #2625](https://tree.taiga.io/project/penpot/issue/2625)
- Fix auto hide header in viewer full screen [Taiga #2632](https://tree.taiga.io/project/penpot/issue/2632)
- Fix zoom in/out after fit or fill [Taiga #2630](https://tree.taiga.io/project/penpot/issue/2630)
### :arrow_up: Deps updates

View file

@ -190,19 +190,21 @@
(ptk/reify ::increase-zoom
ptk/UpdateEvent
(update [_ state]
(let [increase #(nth c/zoom-levels
(+ (d/index-of c/zoom-levels %) 1)
(last c/zoom-levels))]
(update-in state [:viewer-local :zoom] (fnil increase 1))))))
(let [increase (fn [zoom]
(d/seek #(> % zoom)
c/zoom-levels
zoom))]
(update-in state [:viewer-local :zoom] increase)))))
(def decrease-zoom
(ptk/reify ::decrease-zoom
ptk/UpdateEvent
(update [_ state]
(let [decrease #(nth c/zoom-levels
(- (d/index-of c/zoom-levels %) 1)
(first c/zoom-levels))]
(update-in state [:viewer-local :zoom] (fnil decrease 1))))))
(let [decrease (fn [zoom]
(d/seek #(< % zoom)
(reverse c/zoom-levels)
zoom))]
(update-in state [:viewer-local :zoom] decrease)))))
(def reset-zoom
(ptk/reify ::reset-zoom