mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
🐛 Fix problem with resizes in plugins
This commit is contained in:
parent
e4f0a2d54d
commit
79604dacbb
@ -23,6 +23,8 @@
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(def debounce-resize-text-time 40)
|
||||
|
||||
(defn get-wasm-text-new-size
|
||||
"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)."
|
||||
@ -144,7 +146,7 @@
|
||||
(rx/merge
|
||||
(->> stream
|
||||
(rx/filter (ptk/type? ::resize-wasm-text-debounce-inner))
|
||||
(rx/debounce 40)
|
||||
(rx/debounce debounce-resize-text-time)
|
||||
(rx/take 1)
|
||||
(rx/map (fn [evt]
|
||||
(resize-wasm-text-debounce-commit
|
||||
|
||||
@ -15,6 +15,8 @@
|
||||
[app.common.types.text :as txt]
|
||||
[app.main.data.workspace.shapes :as dwsh]
|
||||
[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.store :as st]
|
||||
[app.plugins.format :as format]
|
||||
@ -23,7 +25,8 @@
|
||||
[app.plugins.utils :as u]
|
||||
[app.util.object :as obj]
|
||||
[app.util.text-editor :as ted]
|
||||
[cuerdas.core :as str]))
|
||||
[cuerdas.core :as str]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; This regex seems duplicated but probably in the future when we support diferent units
|
||||
;; this will need to reflect changes for each property
|
||||
@ -417,8 +420,10 @@
|
||||
(st/emit! (dwt/update-editor-state shape editor)))
|
||||
|
||||
:else
|
||||
(st/emit! (dwsh/update-shapes [id]
|
||||
#(update % :content txt/change-text value))))))}
|
||||
(do
|
||||
(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"
|
||||
:get #(-> % u/proxy->shape :grow-type d/name)
|
||||
@ -434,7 +439,10 @@
|
||||
(u/not-valid plugin-id :growType "Plugin doesn't have 'content:write' permission")
|
||||
|
||||
: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"
|
||||
:get #(-> % u/proxy->shape text-props :font-id format/format-mixed)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user