0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

Add workaround to broken texts exception.

This commit is contained in:
Andrey Antukh 2020-11-30 10:32:21 +01:00 committed by Hirunatan
parent 357e779013
commit 0416ce8da6

View file

@ -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))
(when (and (pos? shape-width)
(pos? shape-height))
(st/emit! (dw/update-dimensions [id] :width new-width)
(dw/update-dimensions [id] :height new-height))
(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]