0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-13 16:21:57 -05:00

Rename scroll atom to scroll-a on workspace/base and all affected code.

This commit is contained in:
Andrey Antukh 2016-02-15 22:57:36 +02:00
parent f28a6e4138
commit f36a61dcc6
4 changed files with 10 additions and 9 deletions

View file

@ -59,7 +59,7 @@
(rx/merge $ (rx/of (gpt/point)))
(rx/dedupe $)))
(defonce scroll
(defonce scroll-a
(rx/to-atom scroll-s))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -83,6 +83,9 @@
(rx/map :canvas-coords)
(rx/share)))
(defonce mouse-a
(rx/to-atom mouse-s))
(defonce mouse-absolute-s
(->> mouse-b
(rx/filter #(= (:id %) (:id @page-l)))

View file

@ -44,7 +44,7 @@
(define-once :drawing-subscriptions
(letfn [(init-shape [shape]
(let [{:keys [x y] :as point} (gpt/subtract @wb/mouse-position
@wb/scroll)
@wb/scroll-a)
shape (sh/-initialize shape {:x1 x :y1 y :x2 x :y2 y})]
(reset! +drawing-shape+ shape)
@ -58,7 +58,7 @@
(rx/subscribe $ on-value nil on-complete))))
(on-value [[pos ctrl?]]
(let [point (gpt/subtract pos @wb/scroll)]
(let [point (gpt/subtract pos @wb/scroll-a)]
(reset! +drawing-position+ (assoc point :lock ctrl?))))
(on-complete []
@ -71,7 +71,7 @@
(reset! +drawing-shape+ nil)))
(init-icon [shape]
(let [{:keys [x y]} (gpt/subtract @wb/mouse-position @wb/scroll)
(let [{:keys [x y]} (gpt/subtract @wb/mouse-position @wb/scroll-a)
props {:x1 x :y1 y :x2 (+ x 100) :y2 (+ y 100)}
shape (sh/-initialize shape props)]
(rs/emit! (dw/add-shape shape)

View file

@ -60,10 +60,8 @@
(define-once :selrect-subscriptions
(letfn [(on-value [pos]
(let [pos (gpt/subtract pos @wb/scroll)]
(if (nil? @selrect-pos)
(reset! selrect-pos {:start pos :current pos})
(swap! selrect-pos assoc :current pos))))
(let [pos (gpt/add pos @wb/scroll-a)]
(swap! selrect-pos assoc :current pos)))
(on-complete []
(let [selrect (selrect->rect @selrect-pos)]

View file

@ -494,7 +494,7 @@
(let [local (:rum/local own)
zoom 1
shape (rum/react shape)
scroll (rum/react wb/scroll)
scroll (rum/react wb/scroll-a)
pos (-> (get-position shape)
(gpt/subtract scroll)) ;; and multiply by zoom in future
menus (get +menus-map+ (:type shape))