mirror of
https://github.com/penpot/penpot.git
synced 2025-06-03 17:41:39 +02:00
🎉 Recursive drawing shapes in rust
This commit is contained in:
parent
132b1800c2
commit
b149f96500
7 changed files with 76 additions and 60 deletions
|
@ -26,6 +26,7 @@
|
|||
[app.common.types.pages-list :as ctpl]
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.types.shape-tree :as ctst]
|
||||
[app.common.types.shape.impl :as shape.impl]
|
||||
[app.common.types.token :as cto]
|
||||
[app.common.types.token-theme :as ctot]
|
||||
[app.common.types.tokens-lib :as ctob]
|
||||
|
@ -540,7 +541,7 @@
|
|||
(when verify?
|
||||
(check-changes! items))
|
||||
|
||||
(binding [*touched-changes* (volatile! #{})]
|
||||
(binding [*touched-changes* (volatile! #{}) shape.impl/*wasm-sync* true]
|
||||
(let [result (reduce #(or (process-change %1 %2) %1) data items)
|
||||
result (reduce process-touched-change result @*touched-changes*)]
|
||||
;; Validate result shapes (only on the backend)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
(defonce wasm-set-shape-selrect (constantly nil))
|
||||
(defonce wasm-set-shape-transform (constantly nil))
|
||||
(defonce wasm-set-shape-rotation (constantly nil))
|
||||
(defonce wasm-set-shapes (constantly nil))
|
||||
|
||||
(cr/defrecord Shape [id name type x y width height rotation selrect points
|
||||
transform transform-inverse parent-id frame-id flip-x flip-y])
|
||||
|
@ -113,9 +114,10 @@
|
|||
(when *wasm-sync*
|
||||
(wasm-use-shape (:id coll))
|
||||
(case k
|
||||
:selrect (wasm-set-shape-selrect v)
|
||||
:rotation (wasm-set-shape-rotation v)
|
||||
:selrect (wasm-set-shape-selrect v)
|
||||
:rotation (wasm-set-shape-rotation v)
|
||||
:transform (wasm-set-shape-transform v)
|
||||
:shapes (wasm-set-shapes v)
|
||||
nil))
|
||||
(let [delegate (.-delegate ^ShapeProxy coll)
|
||||
delegate' (assoc delegate k v)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue