mirror of
https://github.com/penpot/penpot.git
synced 2025-03-11 07:11:32 -05:00
⚡ Add minor perf improvement on components-v2 migration
This commit is contained in:
parent
0078c0e601
commit
68c0b0e8a7
1 changed files with 73 additions and 73 deletions
|
@ -326,12 +326,13 @@
|
||||||
main instances for all components there and remove shapes from library components.
|
main instances for all components there and remove shapes from library components.
|
||||||
Mark the file with the :components-v2 option."
|
Mark the file with the :components-v2 option."
|
||||||
[file-data]
|
[file-data]
|
||||||
|
(let [migrated? (dm/get-in file-data [:options :components-v2])]
|
||||||
|
(if migrated?
|
||||||
|
file-data
|
||||||
(let [components (ctkl/components-seq file-data)]
|
(let [components (ctkl/components-seq file-data)]
|
||||||
(if (or (empty? components)
|
(if (empty? components)
|
||||||
(dm/get-in file-data [:options :components-v2]))
|
|
||||||
(assoc-in file-data [:options :components-v2] true)
|
(assoc-in file-data [:options :components-v2] true)
|
||||||
(let [grid-gap 50
|
(let [grid-gap 50
|
||||||
|
|
||||||
[file-data page-id start-pos]
|
[file-data page-id start-pos]
|
||||||
(get-or-add-library-page file-data grid-gap)
|
(get-or-add-library-page file-data grid-gap)
|
||||||
|
|
||||||
|
@ -392,10 +393,9 @@
|
||||||
root-to-board
|
root-to-board
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
(cond-> shape
|
(cond-> shape
|
||||||
(and (ctk/instance-head? shape)
|
(and (ctk/instance-root? shape)
|
||||||
(not= (:type shape) :frame))
|
(cph/frame-shape? shape))
|
||||||
(assoc :type :frame
|
(assoc :fills []
|
||||||
:fills []
|
|
||||||
:hide-in-viewer true
|
:hide-in-viewer true
|
||||||
:rx 0
|
:rx 0
|
||||||
:ry 0)))
|
:ry 0)))
|
||||||
|
@ -407,7 +407,7 @@
|
||||||
(-> file-data
|
(-> file-data
|
||||||
(add-instance-grid (sort-by :name components))
|
(add-instance-grid (sort-by :name components))
|
||||||
(update :pages-index update-vals roots-to-board)
|
(update :pages-index update-vals roots-to-board)
|
||||||
(assoc-in [:options :components-v2] true))))))
|
(assoc-in [:options :components-v2] true))))))))
|
||||||
|
|
||||||
(defn- absorb-components
|
(defn- absorb-components
|
||||||
[file-data used-components library-data]
|
[file-data used-components library-data]
|
||||||
|
|
Loading…
Add table
Reference in a new issue