0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 22:49:01 -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 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 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 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 ### :arrow_up: Deps updates

View file

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