From 0416ce8da605392fbe4e3c0d0deba6c200f78484 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 30 Nov 2020 10:32:21 +0100 Subject: [PATCH] :sparkles: Add workaround to broken texts exception. --- frontend/src/app/main/ui/workspace/shapes/text.cljs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/shapes/text.cljs b/frontend/src/app/main/ui/workspace/shapes/text.cljs index 52ddeba2a..895de130e 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text.cljs @@ -41,7 +41,8 @@ ;; --- Text Wrapper for workspace -(defn handle-shape-resize [{:keys [id selrect grow-type overflow-text]} new-width new-height] +(defn handle-shape-resize + [{:keys [id selrect grow-type overflow-text]} new-width new-height] (let [{shape-width :width shape-height :height} selrect undo-transaction (get-in @st/state [:workspace-undo :transaction])] (when (not undo-transaction) (st/emit! dwc/start-undo-transaction)) @@ -59,11 +60,14 @@ (and (or (not= shape-width new-width) (not= shape-height new-height)) (= grow-type :auto-width)) - (st/emit! (dw/update-dimensions [id] :width new-width) - (dw/update-dimensions [id] :height new-height)) + (when (and (pos? shape-width) + (pos? shape-height)) + (st/emit! (dw/update-dimensions [id] :width new-width) + (dw/update-dimensions [id] :height new-height))) (and (not= shape-height new-height) (= grow-type :auto-height)) - (st/emit! (dw/update-dimensions [id] :height new-height)))) + (when (pos? shape-height) + (st/emit! (dw/update-dimensions [id] :height new-height))))) (when (not undo-transaction) (st/emit! dwc/discard-undo-transaction)))) (defn resize-observer [{:keys [id selrect grow-type overflow-text] :as shape} root query]