mirror of
https://github.com/penpot/penpot.git
synced 2026-08-01 19:06:18 +00:00
Merge pull request #8349 from penpot/alotor-fix-editor-selrect
🐛 Fix problem with text editor outline
This commit is contained in:
commit
38ad24ea07
@ -7,6 +7,7 @@
|
|||||||
(ns app.main.ui.workspace.shapes.text.text-edition-outline
|
(ns app.main.ui.workspace.shapes.text.text-edition-outline
|
||||||
(:require
|
(:require
|
||||||
[app.common.geom.shapes :as gsh]
|
[app.common.geom.shapes :as gsh]
|
||||||
|
[app.common.math :as mth]
|
||||||
[app.main.data.helpers :as dsh]
|
[app.main.data.helpers :as dsh]
|
||||||
[app.main.data.workspace.texts :as dwt]
|
[app.main.data.workspace.texts :as dwt]
|
||||||
[app.main.features :as features]
|
[app.main.features :as features]
|
||||||
@ -18,14 +19,19 @@
|
|||||||
(mf/defc text-edition-outline
|
(mf/defc text-edition-outline
|
||||||
[{:keys [shape zoom modifiers]}]
|
[{:keys [shape zoom modifiers]}]
|
||||||
(if (features/active-feature? @st/state "render-wasm/v1")
|
(if (features/active-feature? @st/state "render-wasm/v1")
|
||||||
(let [{:keys [width height]} (wasm.api/get-text-dimensions (:id shape))
|
(let [selrect-transform (mf/deref refs/workspace-selrect)
|
||||||
selrect-transform (mf/deref refs/workspace-selrect)
|
[selrect transform] (dsh/get-selrect selrect-transform shape)
|
||||||
[selrect transform] (dsh/get-selrect selrect-transform shape)]
|
|
||||||
|
[sr-width sr-height]
|
||||||
|
(if (or (mth/close? (:width selrect) 0.01) (mth/close? (:height selrect) 0.01))
|
||||||
|
(let [{:keys [width height]} (wasm.api/get-text-dimensions (:id shape))]
|
||||||
|
[width height])
|
||||||
|
[(:width selrect) (:height selrect)])]
|
||||||
[:rect.main.viewport-selrect
|
[:rect.main.viewport-selrect
|
||||||
{:x (:x selrect)
|
{:x (:x selrect)
|
||||||
:y (:y selrect)
|
:y (:y selrect)
|
||||||
:width (max width (:width selrect))
|
:width sr-width
|
||||||
:height (max height (:height selrect))
|
:height sr-height
|
||||||
:transform transform
|
:transform transform
|
||||||
:style {:stroke "var(--color-accent-tertiary)"
|
:style {:stroke "var(--color-accent-tertiary)"
|
||||||
:stroke-width (/ 1 zoom)
|
:stroke-width (/ 1 zoom)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user