mirror of
https://github.com/penpot/penpot.git
synced 2026-09-09 21:49:10 +00:00
Add alignment to resize.
This commit is contained in:
parent
7d17926060
commit
9e25f7ab9d
@ -10,7 +10,8 @@
|
|||||||
[uxbox.rstore :as rs]
|
[uxbox.rstore :as rs]
|
||||||
[uxbox.data.shapes :as uds]
|
[uxbox.data.shapes :as uds]
|
||||||
[uxbox.ui.core :as uuc]
|
[uxbox.ui.core :as uuc]
|
||||||
[uxbox.ui.workspace.base :as uuwb]
|
[uxbox.ui.workspace.base :as wb]
|
||||||
|
[uxbox.ui.workspace.align :as align]
|
||||||
[uxbox.util.geom.point :as gpt]))
|
[uxbox.util.geom.point :as gpt]))
|
||||||
|
|
||||||
(declare initialize)
|
(declare initialize)
|
||||||
@ -33,11 +34,21 @@
|
|||||||
stoper (->> uuc/actions-s
|
stoper (->> uuc/actions-s
|
||||||
(rx/map :type)
|
(rx/map :type)
|
||||||
(rx/filter #(empty? %))
|
(rx/filter #(empty? %))
|
||||||
(rx/take 1))]
|
(rx/take 1))
|
||||||
(as-> uuwb/mouse-delta-s $
|
|
||||||
(rx/take-until stoper $)
|
align? @wb/alignment-l
|
||||||
(rx/with-latest-from vector uuwb/mouse-ctrl-s $)
|
stream (->> wb/mouse-viewport-s
|
||||||
(rx/subscribe $ #(handle-resize payload %)))))
|
(rx/sample 10)
|
||||||
|
(rx/mapcat (fn [point]
|
||||||
|
(if align?
|
||||||
|
(align/translate point)
|
||||||
|
(rx/of point))))
|
||||||
|
(rx/buffer 2 1)
|
||||||
|
(rx/map wb/coords-delta)
|
||||||
|
(rx/take-until stoper)
|
||||||
|
(rx/map #(gpt/divide % @wb/zoom-l))
|
||||||
|
(rx/with-latest-from vector wb/mouse-ctrl-s))]
|
||||||
|
(rx/subscribe stream #(handle-resize payload %))))
|
||||||
|
|
||||||
(defn- handle-resize
|
(defn- handle-resize
|
||||||
[{:keys [vid shape]} [delta ctrl?]]
|
[{:keys [vid shape]} [delta ctrl?]]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user