0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-14 08:41:48 -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/merge $ (rx/of (gpt/point)))
(rx/dedupe $))) (rx/dedupe $)))
(defonce scroll (defonce scroll-a
(rx/to-atom scroll-s)) (rx/to-atom scroll-s))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -83,6 +83,9 @@
(rx/map :canvas-coords) (rx/map :canvas-coords)
(rx/share))) (rx/share)))
(defonce mouse-a
(rx/to-atom mouse-s))
(defonce mouse-absolute-s (defonce mouse-absolute-s
(->> mouse-b (->> mouse-b
(rx/filter #(= (:id %) (:id @page-l))) (rx/filter #(= (:id %) (:id @page-l)))

View file

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

View file

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

View file

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