0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-15 17:21:17 -05:00

Merge pull request #207 from uxbox/389+394/qa_enhancements

Minor enhancements in selection and movement
This commit is contained in:
Andrey Antukh 2020-05-13 09:30:01 +02:00 committed by GitHub
commit 0c12d7b0d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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