Get rid of buggy reactive locks and refactor all related code.

This commit is contained in:
Andrey Antukh 2017-01-30 17:08:02 +01:00
parent bce58df413
commit b0de23b011
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
18 changed files with 611 additions and 516 deletions

View file

@ -16,7 +16,6 @@
[uxbox.main.data.shapes :as uds]
[uxbox.main.ui.keyboard :as kbd]
[uxbox.util.geom.point :as gpt]
[uxbox.util.rlocks :as rlocks]
[uxbox.util.dom :as dom]))
;; --- Refs
@ -37,12 +36,13 @@
;; --- Movement
;; TODO: implement in the same way as drawing (move under uxbox.main.data.workspace.)
(defn start-move
[]
(letfn [(on-move [shape delta]
(st/emit! (uds/apply-temporal-displacement shape delta)))
(on-stop [{:keys [id] :as shape}]
(rlocks/release! :shape/move)
(st/emit! (uds/apply-displacement shape)))
(on-start [shape]
(let [stoper (->> streams/events
@ -55,7 +55,6 @@
(when @refs/selected-alignment
(st/emit! (uds/initial-align-shape shape)))
(rx/subscribe stream on-move nil on-stop)))]
(rlocks/acquire! :shape/move)
(run! on-start @selected-ref)))
;; --- Events