mirror of
https://github.com/penpot/penpot.git
synced 2025-02-15 03:28:25 -05:00
🐛 Problem with resize 0
This commit is contained in:
parent
0545e7cb28
commit
d17c6d8fce
2 changed files with 19 additions and 6 deletions
|
@ -655,7 +655,21 @@
|
||||||
[shape]
|
[shape]
|
||||||
(let [modifiers (:modifiers shape)
|
(let [modifiers (:modifiers shape)
|
||||||
ds-modifier (:displacement modifiers (gmt/matrix))
|
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))
|
origin (:resize-origin modifiers (gpt/point 0 0))
|
||||||
resize-transform (:resize-transform modifiers (gmt/matrix))
|
resize-transform (:resize-transform modifiers (gmt/matrix))
|
||||||
resize-transform-inverse (:resize-transform-inverse modifiers (gmt/matrix))
|
resize-transform-inverse (:resize-transform-inverse modifiers (gmt/matrix))
|
||||||
|
|
|
@ -272,7 +272,9 @@
|
||||||
on-close
|
on-close
|
||||||
(fn []
|
(fn []
|
||||||
(when (not read-only?)
|
(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
|
on-click-outside
|
||||||
(fn [event]
|
(fn [event]
|
||||||
|
@ -289,10 +291,7 @@
|
||||||
(and cpicker (.contains cpicker target)))
|
(and cpicker (.contains cpicker target)))
|
||||||
(if selecting?
|
(if selecting?
|
||||||
(mf/set-ref-val! selecting-ref false)
|
(mf/set-ref-val! selecting-ref false)
|
||||||
(on-close))))
|
(on-close)))))
|
||||||
|
|
||||||
(when (= 0 (content-size @content-var))
|
|
||||||
(st/emit! (dw/delete-shapes [id]))))
|
|
||||||
|
|
||||||
on-mouse-down
|
on-mouse-down
|
||||||
(fn [event]
|
(fn [event]
|
||||||
|
|
Loading…
Add table
Reference in a new issue