mirror of
https://github.com/penpot/penpot.git
synced 2025-06-13 23:31:39 +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.transit :as t]
|
||||||
[app.common.types.shape :as shape]
|
[app.common.types.shape :as shape]
|
||||||
[app.render-wasm.api :as api]
|
[app.render-wasm.api :as api]
|
||||||
|
[beicon.v2.core :as rx]
|
||||||
[clojure.core :as c]
|
[clojure.core :as c]
|
||||||
[cuerdas.core :as str]))
|
[cuerdas.core :as str]))
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@
|
||||||
[self k v]
|
[self k v]
|
||||||
(when ^boolean shape/*wasm-sync*
|
(when ^boolean shape/*wasm-sync*
|
||||||
(api/use-shape (:id self))
|
(api/use-shape (:id self))
|
||||||
(case k
|
(let [pending (case k
|
||||||
:parent-id (api/set-parent-id v)
|
:parent-id (api/set-parent-id v)
|
||||||
:type (api/set-shape-type v)
|
:type (api/set-shape-type v)
|
||||||
:bool-type (api/set-shape-bool-type v)
|
:bool-type (api/set-shape-bool-type v)
|
||||||
|
@ -130,7 +131,6 @@
|
||||||
:shadow (api/set-shape-shadows v)
|
:shadow (api/set-shape-shadows v)
|
||||||
:constraints-h (api/set-constraints-h v)
|
:constraints-h (api/set-constraints-h v)
|
||||||
:constraints-v (api/set-constraints-v v)
|
:constraints-v (api/set-constraints-v v)
|
||||||
|
|
||||||
:svg-attrs (when (= (:type self) :path)
|
:svg-attrs (when (= (:type self) :path)
|
||||||
(api/set-shape-path-attrs v))
|
(api/set-shape-path-attrs v))
|
||||||
:masked-group (when (and (= (:type self) :group) (:masked-group self))
|
: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))
|
(api/set-shape-svg-raw-content (api/get-static-markup self))
|
||||||
|
|
||||||
(= (:type self) :text)
|
(= (:type self) :text)
|
||||||
(into [] (api/set-shape-text-content v)))
|
(api/set-shape-text-content v))
|
||||||
nil)
|
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")))
|
|
||||||
|
|
||||||
|
;; 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
|
(defn- impl-assoc
|
||||||
[self k v]
|
[self k v]
|
||||||
(set-wasm-attrs self k v)
|
(set-wasm-attrs self k v)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue