mirror of
https://github.com/penpot/penpot.git
synced 2025-06-11 00:01:40 +02:00
🎉 Update font and variant on change (#6220)
This commit is contained in:
parent
2e3ed0c23f
commit
5937ed57ce
1 changed files with 45 additions and 40 deletions
|
@ -9,6 +9,7 @@
|
|||
[app.common.transit :as t]
|
||||
[app.common.types.shape :as shape]
|
||||
[app.render-wasm.api :as api]
|
||||
[beicon.v2.core :as rx]
|
||||
[clojure.core :as c]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
|
@ -110,7 +111,7 @@
|
|||
[self k v]
|
||||
(when ^boolean shape/*wasm-sync*
|
||||
(api/use-shape (:id self))
|
||||
(case k
|
||||
(let [pending (case k
|
||||
:parent-id (api/set-parent-id v)
|
||||
:type (api/set-shape-type v)
|
||||
:bool-type (api/set-shape-bool-type v)
|
||||
|
@ -130,7 +131,6 @@
|
|||
:shadow (api/set-shape-shadows v)
|
||||
:constraints-h (api/set-constraints-h v)
|
||||
:constraints-v (api/set-constraints-v v)
|
||||
|
||||
:svg-attrs (when (= (:type self) :path)
|
||||
(api/set-shape-path-attrs v))
|
||||
:masked-group (when (and (= (:type self) :group) (:masked-group self))
|
||||
|
@ -143,16 +143,21 @@
|
|||
(api/set-shape-svg-raw-content (api/get-static-markup self))
|
||||
|
||||
(= (:type self) :text)
|
||||
(into [] (api/set-shape-text-content v)))
|
||||
nil)
|
||||
;; when something synced with wasm
|
||||
;; is modified, we need to request
|
||||
;; a new render.
|
||||
;; TODO: set-wasm-attrs is called twice with every set
|
||||
;; (println "set-wasm-attrs" (:id self) k v)
|
||||
(api/update-shape-tiles)
|
||||
(api/request-render "set-wasm-attrs")))
|
||||
(api/set-shape-text-content v))
|
||||
nil)]
|
||||
|
||||
;; TODO: set-wasm-attrs is called twice with every set
|
||||
(if (and pending (seq pending))
|
||||
(->> (rx/from pending)
|
||||
(rx/mapcat identity)
|
||||
(rx/reduce conj [])
|
||||
(rx/subs! (fn [_]
|
||||
(api/update-shape-tiles)
|
||||
(api/clear-drawing-cache)
|
||||
(api/request-render "set-wasm-attrs-pending"))))
|
||||
(do
|
||||
(api/update-shape-tiles)
|
||||
(api/request-render "set-wasm-attrs"))))))
|
||||
(defn- impl-assoc
|
||||
[self k v]
|
||||
(set-wasm-attrs self k v)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue