Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (let [start-xy-chan (om/get-state owner :start-xy-chan)
- change-xy-chan (om/get-state owner :change-xy-chan)
- end-xy-chan (om/get-state owner :end-xy-chan)]
- (go
- (loop []
- (let [[x0 y0] (<! start-xy-chan)]
- (loop []
- (let [[[x1 y1] ch] (alts! [change-xy-chan end-xy-chan])
- dx (- x0 x1)
- dy (- y0 y1)]
- (om/transact! app
- (fn [{:keys [currentUser] :as all}]
- (update-in all [:users currentUser :position]
- (let [zoom (get-in all [:users currentUser :zoom])]
- (fn [[x y]]
- [(+ x (/ dx zoom)) (+ y (/ dy zoom))]))))))
- (if (= ch change-xy-chan)
- (recur))))
- (recur))))
Advertisement
Add Comment
Please, Sign In to add comment