mirror of
https://github.com/penpot/penpot.git
synced 2025-03-18 10:41:29 -05:00
🐛 Fix broken points on image shapes in comp-v2 migration
This commit is contained in:
parent
43c13ed432
commit
db5946d1ab
1 changed files with 28 additions and 3 deletions
|
@ -111,9 +111,14 @@
|
|||
(def valid-color?
|
||||
(sm/lazy-validator ::ctc/color))
|
||||
|
||||
(def valid-fill? (sm/lazy-validator ::cts/fill))
|
||||
(def valid-stroke? (sm/lazy-validator ::cts/stroke))
|
||||
(def valid-flow? (sm/lazy-validator ::ctp/flow))
|
||||
(def valid-fill?
|
||||
(sm/lazy-validator ::cts/fill))
|
||||
|
||||
(def valid-stroke?
|
||||
(sm/lazy-validator ::cts/stroke))
|
||||
|
||||
(def valid-flow?
|
||||
(sm/lazy-validator ::ctp/flow))
|
||||
|
||||
(def valid-text-content?
|
||||
(sm/lazy-validator ::ctsx/content))
|
||||
|
@ -130,6 +135,9 @@
|
|||
(def valid-shape-points?
|
||||
(sm/lazy-validator ::cts/points))
|
||||
|
||||
(def valid-image-attrs?
|
||||
(sm/lazy-validator ::cts/image-attrs))
|
||||
|
||||
(defn- prepare-file-data
|
||||
"Apply some specific migrations or fixes to things that are allowed in v1 but not in v2,
|
||||
or that are the result of old bugs."
|
||||
|
@ -330,6 +338,23 @@
|
|||
(some? (:main-instance shape))
|
||||
(dissoc :main-instance)
|
||||
|
||||
(and (cfh/image-shape? shape)
|
||||
(valid-image-attrs? shape)
|
||||
(grc/valid-rect? (:selrect shape))
|
||||
(not (valid-shape-points? (:points shape))))
|
||||
(as-> shape
|
||||
(let [selrect (:selrect shape)
|
||||
metadata (:metadata shape)
|
||||
selrect (grc/make-rect
|
||||
(:x selrect)
|
||||
(:y selrect)
|
||||
(:width metadata)
|
||||
(:height metadata))
|
||||
points (grc/rect->points selrect)]
|
||||
(assoc shape
|
||||
:selrect selrect
|
||||
:points points)))
|
||||
|
||||
(and (cfh/text-shape? shape)
|
||||
(valid-text-content? (:content shape))
|
||||
(not (valid-shape-points? (:points shape)))
|
||||
|
|
Loading…
Add table
Reference in a new issue