diff --git a/common/app/common/geom/shapes.cljc b/common/app/common/geom/shapes.cljc index 85a824b62..de18537fc 100644 --- a/common/app/common/geom/shapes.cljc +++ b/common/app/common/geom/shapes.cljc @@ -655,7 +655,21 @@ [shape] (let [modifiers (:modifiers shape) ds-modifier (:displacement modifiers (gmt/matrix)) - resize (:resize-vector modifiers (gpt/point 1 1)) + {res-x :x res-y :y} (:resize-vector modifiers (gpt/point 1 1)) + + ;; Normalize x/y vector coordinates because scale by 0 is infinite + res-x (cond + (and (< res-x 0) (> res-x -0.01)) -0.01 + (and (> res-x 0) (< res-x 0.01)) 0.01 + :else res-x) + + res-y (cond + (and (< res-y 0) (> res-y -0.01)) -0.01 + (and (> res-y 0) (< res-y 0.01)) 0.01 + :else res-y) + + resize (gpt/point res-x res-y) + origin (:resize-origin modifiers (gpt/point 0 0)) resize-transform (:resize-transform modifiers (gmt/matrix)) resize-transform-inverse (:resize-transform-inverse modifiers (gmt/matrix)) diff --git a/frontend/src/app/main/ui/workspace/shapes/text.cljs b/frontend/src/app/main/ui/workspace/shapes/text.cljs index d8f13b9aa..f3faf51eb 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text.cljs @@ -272,7 +272,9 @@ on-close (fn [] (when (not read-only?) - (st/emit! dw/clear-edition-mode))) + (st/emit! dw/clear-edition-mode)) + (when (= 0 (content-size @content-var)) + (st/emit! (dw/delete-shapes [id])))) on-click-outside (fn [event] @@ -289,10 +291,7 @@ (and cpicker (.contains cpicker target))) (if selecting? (mf/set-ref-val! selecting-ref false) - (on-close)))) - - (when (= 0 (content-size @content-var)) - (st/emit! (dw/delete-shapes [id])))) + (on-close))))) on-mouse-down (fn [event]