mirror of
https://github.com/penpot/penpot.git
synced 2025-05-21 06:46:11 +02:00
🐛 Fix performance problem with new texts
This commit is contained in:
parent
a753037178
commit
ea7266dc3b
3 changed files with 9 additions and 8 deletions
|
@ -41,7 +41,8 @@
|
||||||
|
|
||||||
(mf/defc root-shape
|
(mf/defc root-shape
|
||||||
"Draws the root shape of the viewport and recursively all the shapes"
|
"Draws the root shape of the viewport and recursively all the shapes"
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap [mf/memo]
|
||||||
|
::mf/wrap-props false}
|
||||||
[props]
|
[props]
|
||||||
(let [objects (obj/get props "objects")
|
(let [objects (obj/get props "objects")
|
||||||
active-frames (obj/get props "active-frames")
|
active-frames (obj/get props "active-frames")
|
||||||
|
|
|
@ -114,11 +114,10 @@
|
||||||
(mf/deps all-children)
|
(mf/deps all-children)
|
||||||
(fn []
|
(fn []
|
||||||
(->> all-children
|
(->> all-children
|
||||||
(filter #(= :text (:type %)))
|
(filter #(and (= :text (:type %)) (not (:hidden %))))
|
||||||
(every? #(some? (:position-data %))))))
|
(every? #(some? (:position-data %))))))
|
||||||
|
|
||||||
show-thumbnail?
|
show-thumbnail? (and thumbnail? (some? (:thumbnail shape)) all-svg-text?)]
|
||||||
(and thumbnail? (some? (:thumbnail shape)) all-svg-text?)]
|
|
||||||
|
|
||||||
[:g.frame-wrapper {:display (when (:hidden shape) "none")}
|
[:g.frame-wrapper {:display (when (:hidden shape) "none")}
|
||||||
[:> shape-container {:shape shape}
|
[:> shape-container {:shape shape}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
(ns app.main.ui.workspace.viewport.utils
|
(ns app.main.ui.workspace.viewport.utils
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
|
[app.common.data.macros :as dm]
|
||||||
[app.common.geom.matrix :as gmt]
|
[app.common.geom.matrix :as gmt]
|
||||||
[app.common.geom.point :as gpt]
|
[app.common.geom.point :as gpt]
|
||||||
[app.main.ui.cursors :as cur]
|
[app.main.ui.cursors :as cur]
|
||||||
|
@ -158,10 +159,10 @@
|
||||||
(dom/remove-attribute node "transform")))))))
|
(dom/remove-attribute node "transform")))))))
|
||||||
|
|
||||||
(defn format-viewbox [vbox]
|
(defn format-viewbox [vbox]
|
||||||
(str/join " " [(:x vbox 0)
|
(dm/str (:x vbox 0) " "
|
||||||
(:y vbox 0)
|
(:y vbox 0) " "
|
||||||
(:width vbox 0)
|
(:width vbox 0) " "
|
||||||
(:height vbox 0)]))
|
(:height vbox 0)))
|
||||||
|
|
||||||
(defn translate-point-to-viewport [viewport zoom pt]
|
(defn translate-point-to-viewport [viewport zoom pt]
|
||||||
(let [vbox (.. ^js viewport -viewBox -baseVal)
|
(let [vbox (.. ^js viewport -viewBox -baseVal)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue