Normalize the content prop from bool type (#6162)

Make it the same as path shape, because they are essentially the
same data type
This commit is contained in:
Andrey Antukh 2025-03-27 11:15:48 +01:00 committed by GitHub
parent 3cf823ffb3
commit ebf3730454
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 50 additions and 31 deletions

View file

@ -24,7 +24,7 @@
metadata? (mf/use-ctx use/include-metadata-ctx)
content (mf/with-memo [shape child-objs]
(let [content (:bool-content shape)]
(let [content (:content shape)]
(cond
(some? content)
content

View file

@ -35,7 +35,7 @@
shape (cond-> shape
^boolean child-sel?
(dissoc :bool-content))]
(dissoc :content))]
[:> shape-container {:shape shape}
[:& bool-shape {:shape shape

View file

@ -420,9 +420,11 @@
[bool-type]
(h/call internal-module "_set_shape_bool_type" (sr/translate-bool-type bool-type)))
(defn set-shape-bool-content
[content]
(set-shape-path-content content))
(defn- translate-blur-type
[blur-type]
(case blur-type
:layer-blur 1
0))
(defn set-shape-blur
[blur]
@ -800,7 +802,6 @@
(dm/get-prop shape :r2)
(dm/get-prop shape :r3)
(dm/get-prop shape :r4)])
bool-content (dm/get-prop shape :bool-content)
svg-attrs (dm/get-prop shape :svg-attrs)
shadows (dm/get-prop shape :shadow)]
@ -821,12 +822,13 @@
(set-masked masked))
(when (some? blur)
(set-shape-blur blur))
(when (and (some? content) (= type :path))
(when (and (some? content)
(or (= type :path)
(= type :bool)))
(set-shape-path-attrs svg-attrs)
(set-shape-path-content content))
(when (and (some? content) (= type :svg-raw))
(set-shape-svg-raw-content (get-static-markup shape)))
(when (some? bool-content) (set-shape-bool-content bool-content))
(when (some? corners) (set-shape-corners corners))
(when (some? shadows) (set-shape-shadows shadows))
(when (and (= type :text) (some? content))

View file

@ -114,7 +114,6 @@
:parent-id (api/set-parent-id v)
:type (api/set-shape-type v)
:bool-type (api/set-shape-bool-type v)
:bool-content (api/set-shape-bool-content v)
:selrect (api/set-shape-selrect v)
:show-content (if (= (:type self) :frame)
(api/set-shape-clip-content (not v))