mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 00:10:11 -05:00
🐛 Fixes zoom when left sidebar collapsed
This commit is contained in:
parent
609eb4f342
commit
51697c63dd
1 changed files with 5 additions and 3 deletions
|
@ -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])))))
|
||||
|
|
Loading…
Reference in a new issue