0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-04 19:11:20 -05:00

🐛 Fix problems with zoomIntoView

This commit is contained in:
alonso.torres 2025-02-05 13:22:52 +01:00 committed by Andrey Antukh
parent b0d0abb0ad
commit 8217bbc7a0
2 changed files with 10 additions and 9 deletions

View file

@ -55,7 +55,7 @@ is a number of cores)
- Fix error when reseting stroke cap
- Fix problem with strokes not refreshing in Safari [Taiga #9040](https://tree.taiga.io/project/penpot/issue/9040)
- Fix problem with multiple color changes [Taiga #9631](https://tree.taiga.io/project/penpot/issue/9631)
- Fix problem in plugins with zoomIntoView [Plugins #189](https://github.com/penpot/penpot-plugins/issues/189)
## 2.4.3

View file

@ -8,11 +8,11 @@
(:require
[app.common.data.macros :as dm]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.main.data.workspace.viewport :as dwv]
[app.main.data.workspace.zoom :as dwz]
[app.main.store :as st]
[app.plugins.format :as format]
[app.plugins.shape :as ps]
[app.plugins.utils :as u]
[app.util.object :as obj]))
@ -85,12 +85,13 @@
:zoomIntoView
(fn [shapes]
(let [ids
(->> shapes
(map (fn [v]
(if (string? v)
(uuid/uuid v)
(uuid/uuid (obj/get v "x"))))))]
(st/emit! (dwz/fit-to-shapes ids))))))
(cond
(not (every? ps/shape-proxy? shapes))
(u/display-not-valid :zoomIntoView "Argument should be valid shapes")
:else
(let [ids (->> shapes
(map (fn [shape] (obj/get shape "$id"))))]
(st/emit! (dwz/fit-to-shapes ids)))))))