0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-15 11:38:24 -05:00

Limiting the resize to correct behavior

This commit is contained in:
Jesús Espino 2016-04-16 23:15:49 +02:00
parent ad73f9c514
commit 9e06ef1729

View file

@ -125,20 +125,20 @@
(defmethod move-vertex ::rect (defmethod move-vertex ::rect
[shape vid {dx :x dy :y lock :lock}] [shape vid {dx :x dy :y lock :lock}]
(let [[dx dy] (if lock [dx dx] [dx dy])] (let [{:keys [x1 x2 y1 y2]} shape]
(case vid (case vid
1 (assoc shape 1 (assoc shape
:x1 (+ (:x1 shape) dx) :x1 (min x2 (+ x1 dx))
:y1 (+ (:y1 shape) dy)) :y1 (min y2 (+ y1 dy)))
2 (assoc shape 2 (assoc shape
:x2 (+ (:x2 shape) dx) :x2 (max x1 (+ x2 dx))
:y1 (+ (:y1 shape) dy)) :y1 (min y2 (+ y1 dy)))
3 (assoc shape 3 (assoc shape
:x1 (+ (:x1 shape) dx) :x1 (min x2 (+ x1 dx))
:y2 (+ (:y2 shape) dy)) :y2 (max y1 (+ y2 dy)))
4 (assoc shape 4 (assoc shape
:x2 (+ (:x2 shape) dx) :x2 (max x1 (+ x2 dx))
:y2 (+ (:y2 shape) dy))))) :y2 (max y1 (+ y2 dy))))))
(defmethod move-vertex :builtin/circle (defmethod move-vertex :builtin/circle
[shape vid {dx :x dy :y lock :lock}] [shape vid {dx :x dy :y lock :lock}]