mirror of
https://github.com/penpot/penpot.git
synced 2026-09-13 15:38:38 +00:00
🐛 Fix problem with resizes in plugins
This commit is contained in:
parent
3f5226485b
commit
e3bafab529
@ -23,6 +23,8 @@
|
|||||||
[beicon.v2.core :as rx]
|
[beicon.v2.core :as rx]
|
||||||
[potok.v2.core :as ptk]))
|
[potok.v2.core :as ptk]))
|
||||||
|
|
||||||
|
(def debounce-resize-text-time 40)
|
||||||
|
|
||||||
(defn get-wasm-text-new-size
|
(defn get-wasm-text-new-size
|
||||||
"Computes the new {width, height} for a text shape from WASM text layout.
|
"Computes the new {width, height} for a text shape from WASM text layout.
|
||||||
For :fixed grow-type, updates WASM content and returns current dimensions (no resize)."
|
For :fixed grow-type, updates WASM content and returns current dimensions (no resize)."
|
||||||
@ -144,7 +146,7 @@
|
|||||||
(rx/merge
|
(rx/merge
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter (ptk/type? ::resize-wasm-text-debounce-inner))
|
(rx/filter (ptk/type? ::resize-wasm-text-debounce-inner))
|
||||||
(rx/debounce 40)
|
(rx/debounce debounce-resize-text-time)
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/map (fn [evt]
|
(rx/map (fn [evt]
|
||||||
(resize-wasm-text-debounce-commit
|
(resize-wasm-text-debounce-commit
|
||||||
|
|||||||
@ -15,6 +15,8 @@
|
|||||||
[app.common.types.text :as txt]
|
[app.common.types.text :as txt]
|
||||||
[app.main.data.workspace.shapes :as dwsh]
|
[app.main.data.workspace.shapes :as dwsh]
|
||||||
[app.main.data.workspace.texts :as dwt]
|
[app.main.data.workspace.texts :as dwt]
|
||||||
|
[app.main.data.workspace.wasm-text :as dwwt]
|
||||||
|
[app.main.features :as features]
|
||||||
[app.main.fonts :as fonts]
|
[app.main.fonts :as fonts]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.plugins.format :as format]
|
[app.plugins.format :as format]
|
||||||
@ -417,8 +419,10 @@
|
|||||||
(st/emit! (dwt/update-editor-state shape editor)))
|
(st/emit! (dwt/update-editor-state shape editor)))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(st/emit! (dwsh/update-shapes [id]
|
(do
|
||||||
#(update % :content txt/change-text value))))))}
|
(st/emit! (dwsh/update-shapes [id] #(update % :content txt/change-text value)))
|
||||||
|
(when (features/active-feature? @st/state "render-wasm/v1")
|
||||||
|
(st/emit! (dwwt/resize-wasm-text-debounce id)))))))}
|
||||||
|
|
||||||
{:name "growType"
|
{:name "growType"
|
||||||
:get #(-> % u/proxy->shape :grow-type d/name)
|
:get #(-> % u/proxy->shape :grow-type d/name)
|
||||||
@ -434,7 +438,10 @@
|
|||||||
(u/not-valid plugin-id :growType "Plugin doesn't have 'content:write' permission")
|
(u/not-valid plugin-id :growType "Plugin doesn't have 'content:write' permission")
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(st/emit! (dwsh/update-shapes [id] #(assoc % :grow-type value))))))}
|
(st/emit!
|
||||||
|
(dwsh/update-shapes [id] #(assoc % :grow-type value))
|
||||||
|
(when (features/active-feature? @st/state "render-wasm/v1")
|
||||||
|
(st/emit! (dwwt/resize-wasm-text-debounce id)))))))}
|
||||||
|
|
||||||
{:name "fontId"
|
{:name "fontId"
|
||||||
:get #(-> % u/proxy->shape text-props :font-id format/format-mixed)
|
:get #(-> % u/proxy->shape text-props :font-id format/format-mixed)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user