From fb1dbd6f31899aea929b4da0d9541a4e5a11c429 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 20 Jun 2022 11:29:52 +0200 Subject: [PATCH] :bug: Fix problem with empty text boxes events --- CHANGES.md | 1 + .../main/ui/workspace/shapes/text/editor.cljs | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index af95b168f..ec8780dfd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,6 +16,7 @@ - Fix menu file not accessible in certain conditions [Taiga #3385](https://tree.taiga.io/project/penpot/issue/3385) - Remove deprecated menu options [Taiga #3333](https://tree.taiga.io/project/penpot/issue/3333) - Prototype connection should be under the rules [Taiga #3384](https://tree.taiga.io/project/penpot/issue/3384) +- Fix problem with empty text boxes events [Taiga #3627](https://tree.taiga.io/project/penpot/issue/3627) ## 1.13.5-beta diff --git a/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs b/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs index 372cbda74..b124d82e1 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs @@ -271,20 +271,24 @@ (mf/deref text-modifier-ref) bounding-box - (gsht/position-data-bounding-box text-modifier)] + (gsht/position-data-bounding-box text-modifier) + + x (min (:x bounding-box) (:x shape)) + y (min (:y bounding-box) (:y shape)) + width (max (:width bounding-box) (:width shape)) + height (max (:height bounding-box) (:height shape))] [:g.text-editor {:clip-path (dm/fmt "url(#%)" clip-id) :transform (dm/str (gsh/transform-matrix shape))} [:defs [:clipPath {:id clip-id} - [:rect {:x (min (:x bounding-box) (:x shape)) - :y (min (:y bounding-box) (:y shape)) - :width (max (:width bounding-box) (:width shape)) - :height (max (:height bounding-box) (:height shape)) + [:rect {:x (or x (:x shape)) + :y (or y (:y shape)) + :width (or width (:width shape)) + :height (or height (:height shape)) :fill "red"}]]] - [:foreignObject {:x (:x shape) :y (:y shape) :width "100%" :height "100%" - :externalResourcesRequired true} + [:foreignObject {:x (:x shape) :y (:y shape) :width "100%" :height "100%"} [:div {:style {:position "absolute" :left 0 :top 0