mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 23:49:45 -05:00
🐛 Fixes tests
This commit is contained in:
parent
60af960f42
commit
c28a2acfc7
3 changed files with 25 additions and 19 deletions
|
@ -284,13 +284,14 @@
|
||||||
|
|
||||||
([command coord]
|
([command coord]
|
||||||
(let [params (:params command)
|
(let [params (:params command)
|
||||||
xkey (cond (= :c1 coord) :c1x
|
xkey (case coord
|
||||||
(= :c2 coord) :c2x
|
:c1 :c1x
|
||||||
:else :x)
|
:c2 :c2x
|
||||||
ykey (cond (= :c1 coord) :c1y
|
:x)
|
||||||
(= :c2 coord) :c2y
|
ykey (case coord
|
||||||
:else :y)
|
:c1 :c1y
|
||||||
|
:c2 :c2y
|
||||||
|
:y)
|
||||||
x (get params xkey)
|
x (get params xkey)
|
||||||
y (get params ykey)]
|
y (get params ykey)]
|
||||||
(when (and (some? x) (some? y))
|
(when (and (some? x) (some? y))
|
||||||
|
|
|
@ -22,15 +22,18 @@
|
||||||
;; --- Relative Movement
|
;; --- Relative Movement
|
||||||
|
|
||||||
(defn- move-selrect [selrect pt]
|
(defn- move-selrect [selrect pt]
|
||||||
(let [dx (.-x pt)
|
(when (and (some? selrect) (some? pt))
|
||||||
dy (.-y pt)]
|
(let [dx (.-x pt)
|
||||||
(-> selrect
|
dy (.-y pt)
|
||||||
(update :x + dx)
|
{:keys [x y x1 y1 x2 y2 width height]} selrect]
|
||||||
(update :y + dy)
|
{:x (if (some? x) (+ dx x) x)
|
||||||
(update :x1 + dx)
|
:y (if (some? y) (+ dy y) y)
|
||||||
(update :y1 + dy)
|
:x1 (if (some? x1) (+ dx x1) x1)
|
||||||
(update :x2 + dx)
|
:y1 (if (some? y1) (+ dy y1) y1)
|
||||||
(update :y2 + dy))))
|
:x2 (if (some? x2) (+ dx x2) x2)
|
||||||
|
:y2 (if (some? y2) (+ dy y2) y2)
|
||||||
|
:width width
|
||||||
|
:height height})))
|
||||||
|
|
||||||
(defn- move-points [points move-vec]
|
(defn- move-points [points move-vec]
|
||||||
(->> points
|
(->> points
|
||||||
|
|
|
@ -181,9 +181,11 @@
|
||||||
shape-before (-> (create-test-shape type {:modifiers modifiers})
|
shape-before (-> (create-test-shape type {:modifiers modifiers})
|
||||||
(assoc :selrect selrect))
|
(assoc :selrect selrect))
|
||||||
shape-after (gsh/transform-shape shape-before {:round-coords? false})]
|
shape-after (gsh/transform-shape shape-before {:round-coords? false})]
|
||||||
(= (:selrect shape-before) (:selrect shape-after)))
|
|
||||||
|
|
||||||
:rect {:x 0 :y 0 :width ##Inf :height ##Inf}
|
(= (:selrect shape-before)
|
||||||
:path {:x 0 :y 0 :width ##Inf :height ##Inf}
|
(:selrect shape-after)))
|
||||||
|
|
||||||
|
:rect {:x 0 :y 0 :x1 0 :y1 0 :x2 ##Inf :y2 ##Inf :width ##Inf :height ##Inf}
|
||||||
|
:path {:x 0 :y 0 :x1 0 :y1 0 :x2 ##Inf :y2 ##Inf :width ##Inf :height ##Inf}
|
||||||
:rect nil
|
:rect nil
|
||||||
:path nil)))
|
:path nil)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue