0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 08:11:30 -05:00

Minor enhancements in selection and movement

This commit is contained in:
alonso.torres 2020-05-13 09:28:37 +02:00
parent 27810c9df8
commit e9c97ef5d0
2 changed files with 6 additions and 5 deletions

View file

@ -272,9 +272,9 @@
(s/def ::direction #{:up :down :right :left})
(defn move-selected
[direction align?]
[direction shift?]
(us/verify ::direction direction)
(us/verify boolean? align?)
(us/verify boolean? shift?)
(let [same-event (js/Symbol "same-event")]
(ptk/reify ::move-selected
@ -299,7 +299,8 @@
stopper (->> move-events
(rx/debounce 100)
(rx/first))
mov-vec (get-displacement direction)]
scale (if shift? (gpt/point 10) (gpt/point 1))
mov-vec (gpt/multiply (get-displacement direction) scale)]
(rx/concat
(rx/merge
@ -307,7 +308,7 @@
(rx/take-until stopper)
(rx/scan #(gpt/add %1 mov-vec) (gpt/point 0 0))
(rx/map #(set-modifiers selected {:displacement (gmt/translate-matrix %)})))
(rx/of (move-selected direction align?)))
(rx/of (move-selected direction shift?)))
(rx/of (apply-modifiers selected)
(fn [state] (-> state

View file

@ -112,7 +112,7 @@
:bottom-right [(+ x width) (+ y height)]}]
[:g.controls
(when (not (#{:move :rotate :resize} current-transform))
(when (not (#{:move :rotate} current-transform))
[:rect.main
{:transform transform
:x x :y y