0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 16:30:37 -05:00

🐛 Fixes zoom when left sidebar collapsed

This commit is contained in:
alonso.torres 2020-09-17 16:59:20 +02:00 committed by Andrey Antukh
parent 609eb4f342
commit 51697c63dd

View file

@ -419,13 +419,15 @@
;; --- Zoom Management
(defn- impl-update-zoom
[{:keys [vbox vport] :as local} center zoom]
(let [new-zoom (if (fn? zoom) (zoom (:zoom local)) zoom)
[{:keys [vbox] :as local} center zoom]
(let [vbox (update vbox :x + (:left-offset vbox))
new-zoom (if (fn? zoom) (zoom (:zoom local)) zoom)
old-zoom (:zoom local)
center (if center center (geom/center vbox))
scale (/ old-zoom new-zoom)
mtx (gmt/scale-matrix (gpt/point scale) center)
vbox' (geom/transform vbox mtx)]
vbox' (geom/transform vbox mtx)
vbox' (update vbox' :x - (:left-offset vbox))]
(-> local
(assoc :zoom new-zoom)
(update :vbox merge (select-keys vbox' [:x :y :width :height])))))