mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 00:40:30 -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
|
;; --- Zoom Management
|
||||||
|
|
||||||
(defn- impl-update-zoom
|
(defn- impl-update-zoom
|
||||||
[{:keys [vbox vport] :as local} center zoom]
|
[{:keys [vbox] :as local} center zoom]
|
||||||
(let [new-zoom (if (fn? zoom) (zoom (:zoom local)) zoom)
|
(let [vbox (update vbox :x + (:left-offset vbox))
|
||||||
|
new-zoom (if (fn? zoom) (zoom (:zoom local)) zoom)
|
||||||
old-zoom (:zoom local)
|
old-zoom (:zoom local)
|
||||||
center (if center center (geom/center vbox))
|
center (if center center (geom/center vbox))
|
||||||
scale (/ old-zoom new-zoom)
|
scale (/ old-zoom new-zoom)
|
||||||
mtx (gmt/scale-matrix (gpt/point scale) center)
|
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
|
(-> local
|
||||||
(assoc :zoom new-zoom)
|
(assoc :zoom new-zoom)
|
||||||
(update :vbox merge (select-keys vbox' [:x :y :width :height])))))
|
(update :vbox merge (select-keys vbox' [:x :y :width :height])))))
|
||||||
|
|
Loading…
Reference in a new issue