0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 06:58:58 -05:00

🐛 Fix broken fills and strokes on comp-v2 migration

This commit is contained in:
Andrey Antukh 2024-01-18 11:56:57 +01:00
parent 6ad6e6f856
commit 166d2b7b68

View file

@ -105,6 +105,9 @@
or that are the result of old bugs."
[file-data libraries]
(let [detached-ids (volatile! #{})
valid-color? (sm/validator ::ctc/recent-color)
valid-fill? (sm/validator ::cts/fill)
valid-stroke? (sm/validator ::cts/stroke)
detach-shape
(fn [container shape]
@ -115,7 +118,6 @@
(vswap! detached-ids conj (:id shape)))
(ctk/detach-shape shape)))
fix-missing-image-metadata
(fn [file-data]
(let [update-object
@ -152,6 +154,14 @@
0
gap)))
;; Fix broken fills
(seq (:fills shape))
(update :fills (fn [fills] (filterv valid-fill? fills)))
;; Fix broken strokes
(seq (:strokes shape))
(update :strokes (fn [strokes] (filterv valid-stroke? strokes)))
;; Fix some broken layout related attrs, probably
;; of copypaste on flex layout betatest period
(true? (:layout shape))
@ -171,10 +181,9 @@
fix-recent-colors
(fn [file-data]
(let [valid-color? (sm/validator ::ctc/recent-color)]
(d/update-when file-data :recent-colors
(fn [colors]
(filterv valid-color? colors)))))
(d/update-when file-data :recent-colors
(fn [colors]
(filterv valid-color? colors))))
fix-orphan-shapes
(fn [file-data]