0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-12 18:18:24 -05:00

🐛 Problem with resize 0

This commit is contained in:
alonso.torres 2020-09-22 15:32:33 +02:00 committed by Andrey Antukh
parent 0545e7cb28
commit d17c6d8fce
2 changed files with 19 additions and 6 deletions

View file

@ -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))

View file

@ -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]