mirror of
https://github.com/penpot/penpot.git
synced 2026-05-02 14:48:29 +00:00
♻️ Update frontend rendering and UI for :path-data
Update the WASM render bridge and UI shape components to read :path-data
instead of :content for path and bool shapes. The render_wasm/shape.cljs
case dispatch now handles :path-data separately from :content (which
remains for text and svg-raw shapes).
Affected namespaces:
- app.render-wasm.{shape,api}
- app.main.ui.shapes.{path,bool}
- app.main.ui.workspace.shapes.{path,bool}
- app.main.ui.workspace.shapes.path.editor
Signed-off-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
parent
dc11d19909
commit
4df3f085d8
@ -25,7 +25,7 @@
|
||||
|
||||
metadata? (mf/use-ctx use/include-metadata-ctx)
|
||||
content (mf/with-memo [shape child-objs]
|
||||
(let [content (:content shape)]
|
||||
(let [content (:path-data shape)]
|
||||
(cond
|
||||
(some? content)
|
||||
content
|
||||
@ -34,7 +34,7 @@
|
||||
(path/calc-bool-content shape child-objs))))
|
||||
|
||||
shape (mf/with-memo [shape content]
|
||||
(assoc shape :content content))]
|
||||
(assoc shape :path-data content))]
|
||||
|
||||
[:*
|
||||
(when (some? content)
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
(mf/defc path-shape
|
||||
{::mf/props :obj}
|
||||
[{:keys [shape]}]
|
||||
(let [content (get shape :content)
|
||||
(let [content (get shape :path-data)
|
||||
pdata (mf/with-memo [content]
|
||||
(try
|
||||
(content->string content)
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
shape (cond-> shape
|
||||
^boolean child-sel?
|
||||
(dissoc :content))]
|
||||
(dissoc :path-data))]
|
||||
|
||||
[:> shape-container {:shape shape}
|
||||
[:& bool-shape {:shape shape
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
(defn- apply-content-modifiers
|
||||
[shape content-modifiers]
|
||||
(let [shape (update shape :content types.path/apply-content-modifiers content-modifiers)]
|
||||
(let [shape (update shape :path-data types.path/apply-content-modifiers content-modifiers)]
|
||||
(types.path/update-geometry shape)))
|
||||
|
||||
(mf/defc path-wrapper
|
||||
|
||||
@ -283,7 +283,7 @@
|
||||
(or selected-points #{})
|
||||
|
||||
base-content
|
||||
(get shape :content)
|
||||
(get shape :path-data)
|
||||
|
||||
base-points
|
||||
(mf/with-memo [base-content]
|
||||
|
||||
@ -1028,6 +1028,7 @@
|
||||
(if (= type :text)
|
||||
(ensure-text-content content)
|
||||
content))
|
||||
path-data (get shape :path-data)
|
||||
bool-type (get shape :bool-type)
|
||||
grow-type (get shape :grow-type)
|
||||
blur (get shape :blur)
|
||||
@ -1043,10 +1044,10 @@
|
||||
(set-masked (boolean masked)))
|
||||
(when (= type :bool)
|
||||
(set-shape-bool-type bool-type))
|
||||
(when (and (some? content)
|
||||
(when (and (some? path-data)
|
||||
(or (= type :path)
|
||||
(= type :bool)))
|
||||
(set-shape-path-content content))
|
||||
(set-shape-path-content path-data))
|
||||
(when (some? svg-attrs)
|
||||
(set-shape-svg-attrs svg-attrs))
|
||||
(when (and (some? content) (= type :svg-raw))
|
||||
|
||||
@ -144,7 +144,7 @@
|
||||
(do
|
||||
(api/set-shape-type v)
|
||||
(when (or (= v :path) (= v :bool))
|
||||
(api/set-shape-path-content (:content shape))))
|
||||
(api/set-shape-path-content (:path-data shape))))
|
||||
|
||||
:bool-type
|
||||
(api/set-shape-bool-type v)
|
||||
@ -236,12 +236,13 @@
|
||||
(when (cfh/group-shape? shape)
|
||||
(api/set-masked (boolean (:masked-group shape))))
|
||||
|
||||
:path-data
|
||||
(when (or (cfh/path-shape? shape)
|
||||
(cfh/bool-shape? shape))
|
||||
(api/set-shape-path-content v))
|
||||
|
||||
:content
|
||||
(cond
|
||||
(or (cfh/path-shape? shape)
|
||||
(cfh/bool-shape? shape))
|
||||
(api/set-shape-path-content v)
|
||||
|
||||
(cfh/svg-raw-shape? shape)
|
||||
(api/set-shape-svg-raw-content (api/get-static-markup shape))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user