mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 21:09:00 -05:00
💄 Change stoper to stopper
This commit is contained in:
parent
c123cf6e98
commit
f5dd199bc6
17 changed files with 75 additions and 77 deletions
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [stoper-s (rx/filter (ptk/type? ::finalize) stream)
|
(let [stopper (rx/filter (ptk/type? ::finalize) stream)
|
||||||
profile-id (:profile-id state)]
|
profile-id (:profile-id state)]
|
||||||
|
|
||||||
(->> (rx/merge
|
(->> (rx/merge
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
(rx/filter #(= id (:id %)))
|
(rx/filter #(= id (:id %)))
|
||||||
(rx/map du/set-current-team)))
|
(rx/map du/set-current-team)))
|
||||||
|
|
||||||
(rx/take-until stoper-s))))))
|
(rx/take-until stopper))))))
|
||||||
|
|
||||||
(defn finalize
|
(defn finalize
|
||||||
[params]
|
[params]
|
||||||
|
|
|
@ -234,7 +234,7 @@
|
||||||
ptk/EffectEvent
|
ptk/EffectEvent
|
||||||
(effect [_ _ stream]
|
(effect [_ _ stream]
|
||||||
(let [session (atom nil)
|
(let [session (atom nil)
|
||||||
stoper (rx/filter (ptk/type? ::initialize) stream)
|
stopper (rx/filter (ptk/type? ::initialize) stream)
|
||||||
buffer (atom #queue [])
|
buffer (atom #queue [])
|
||||||
profile (->> (rx/from-atom storage {:emit-current-value? true})
|
profile (->> (rx/from-atom storage {:emit-current-value? true})
|
||||||
(rx/map :profile)
|
(rx/map :profile)
|
||||||
|
@ -259,7 +259,7 @@
|
||||||
(rx/tap (fn [_]
|
(rx/tap (fn [_]
|
||||||
(l/debug :hint "events chunk persisted" :total (count chunk))))
|
(l/debug :hint "events chunk persisted" :total (count chunk))))
|
||||||
(rx/map (constantly chunk))))))
|
(rx/map (constantly chunk))))))
|
||||||
(rx/take-until stoper)
|
(rx/take-until stopper)
|
||||||
(rx/subs! (fn [chunk]
|
(rx/subs! (fn [chunk]
|
||||||
(swap! buffer remove-from-buffer (count chunk)))
|
(swap! buffer remove-from-buffer (count chunk)))
|
||||||
(fn [cause]
|
(fn [cause]
|
||||||
|
@ -290,7 +290,7 @@
|
||||||
(swap! buffer append-to-buffer event)))
|
(swap! buffer append-to-buffer event)))
|
||||||
|
|
||||||
(rx/switch-map #(rx/timer (inst-ms session-timeout)))
|
(rx/switch-map #(rx/timer (inst-ms session-timeout)))
|
||||||
(rx/take-until stoper)
|
(rx/take-until stopper)
|
||||||
(rx/subs! (fn [_]
|
(rx/subs! (fn [_]
|
||||||
(l/debug :hint "session reinitialized")
|
(l/debug :hint "session reinitialized")
|
||||||
(reset! session nil))
|
(reset! session nil))
|
||||||
|
|
|
@ -209,7 +209,7 @@
|
||||||
(rx/filter #(= @resource-id (:resource-id %)))
|
(rx/filter #(= @resource-id (:resource-id %)))
|
||||||
(rx/share))
|
(rx/share))
|
||||||
|
|
||||||
stoper
|
stopper
|
||||||
(rx/filter #(or (= "ended" (:status %))
|
(rx/filter #(or (= "ended" (:status %))
|
||||||
(= "error" (:status %)))
|
(= "error" (:status %)))
|
||||||
progress-stream)]
|
progress-stream)]
|
||||||
|
@ -228,12 +228,12 @@
|
||||||
(initialize-export-status exports cmd resource))))
|
(initialize-export-status exports cmd resource))))
|
||||||
|
|
||||||
;; We proceed to update the export state with incoming
|
;; We proceed to update the export state with incoming
|
||||||
;; progress updates. We delay the stoper for give some time
|
;; progress updates. We delay the stopper for give some time
|
||||||
;; to update the status with ended or errored status before
|
;; to update the status with ended or errored status before
|
||||||
;; close the stream.
|
;; close the stream.
|
||||||
(->> progress-stream
|
(->> progress-stream
|
||||||
(rx/map update-export-status)
|
(rx/map update-export-status)
|
||||||
(rx/take-until (rx/delay 500 stoper))
|
(rx/take-until (rx/delay 500 stopper))
|
||||||
(rx/finalize (fn []
|
(rx/finalize (fn []
|
||||||
(swap! st/ongoing-tasks disj :export))))
|
(swap! st/ongoing-tasks disj :export))))
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/delay default-timeout)
|
(rx/delay default-timeout)
|
||||||
(rx/map #(clear-export-state @resource-id))
|
(rx/map #(clear-export-state @resource-id))
|
||||||
(rx/take-until (rx/delay 6000 stoper))))))))
|
(rx/take-until (rx/delay 6000 stopper))))))))
|
||||||
|
|
||||||
(defn retry-last-export
|
(defn retry-last-export
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -61,16 +61,16 @@
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ stream]
|
(watch [_ _ stream]
|
||||||
(rx/merge
|
(rx/merge
|
||||||
(let [stoper (rx/filter (ptk/type? ::hide) stream)]
|
(let [stopper (rx/filter (ptk/type? ::hide) stream)]
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter (ptk/type? :app.util.router/navigate))
|
(rx/filter (ptk/type? :app.util.router/navigate))
|
||||||
(rx/map (constantly hide))
|
(rx/map (constantly hide))
|
||||||
(rx/take-until stoper)))
|
(rx/take-until stopper)))
|
||||||
(when (:timeout data)
|
(when (:timeout data)
|
||||||
(let [stoper (rx/filter (ptk/type? ::show) stream)]
|
(let [stopper (rx/filter (ptk/type? ::show) stream)]
|
||||||
(->> (rx/of hide)
|
(->> (rx/of hide)
|
||||||
(rx/delay (:timeout data))
|
(rx/delay (:timeout data))
|
||||||
(rx/take-until stoper))))))))
|
(rx/take-until stopper))))))))
|
||||||
|
|
||||||
(def hide
|
(def hide
|
||||||
(ptk/reify ::hide
|
(ptk/reify ::hide
|
||||||
|
@ -80,10 +80,10 @@
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ stream]
|
(watch [_ _ stream]
|
||||||
(let [stoper (rx/filter (ptk/type? ::show) stream)]
|
(let [stopper (rx/filter (ptk/type? ::show) stream)]
|
||||||
(->> (rx/of #(dissoc % :message))
|
(->> (rx/of #(dissoc % :message))
|
||||||
(rx/delay default-animation-timeout)
|
(rx/delay default-animation-timeout)
|
||||||
(rx/take-until stoper))))))
|
(rx/take-until stopper))))))
|
||||||
|
|
||||||
(defn hide-tag
|
(defn hide-tag
|
||||||
[tag]
|
[tag]
|
||||||
|
|
|
@ -51,9 +51,9 @@
|
||||||
|
|
||||||
(vreset! ws-conn ws)
|
(vreset! ws-conn ws)
|
||||||
|
|
||||||
(let [stoper (rx/merge
|
(let [stopper (rx/merge
|
||||||
(rx/filter (ptk/type? ::finalize) stream)
|
(rx/filter (ptk/type? ::finalize) stream)
|
||||||
(rx/filter (ptk/type? ::initialize) stream))]
|
(rx/filter (ptk/type? ::initialize) stream))]
|
||||||
|
|
||||||
(->> (rx/merge
|
(->> (rx/merge
|
||||||
(rx/of #(assoc % :ws-conn ws))
|
(rx/of #(assoc % :ws-conn ws))
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
(->> (ws/get-rcv-stream ws)
|
(->> (ws/get-rcv-stream ws)
|
||||||
(rx/filter ws/opened-event?)
|
(rx/filter ws/opened-event?)
|
||||||
(rx/map (fn [_] (ptk/data-event ::opened {})))))
|
(rx/map (fn [_] (ptk/data-event ::opened {})))))
|
||||||
(rx/take-until stoper)))))))
|
(rx/take-until stopper)))))))
|
||||||
|
|
||||||
;; --- Finalize Websocket
|
;; --- Finalize Websocket
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
[app.main.data.workspace.changes :as dch]
|
[app.main.data.workspace.changes :as dch]
|
||||||
[app.main.data.workspace.collapse :as dwco]
|
[app.main.data.workspace.collapse :as dwco]
|
||||||
[app.main.data.workspace.drawing :as dwd]
|
[app.main.data.workspace.drawing :as dwd]
|
||||||
[app.main.data.workspace.drawing.common :as dwdc]
|
|
||||||
[app.main.data.workspace.edition :as dwe]
|
[app.main.data.workspace.edition :as dwe]
|
||||||
[app.main.data.workspace.fix-bool-contents :as fbc]
|
[app.main.data.workspace.fix-bool-contents :as fbc]
|
||||||
[app.main.data.workspace.fix-broken-shapes :as fbs]
|
[app.main.data.workspace.fix-broken-shapes :as fbs]
|
||||||
|
@ -153,7 +152,7 @@
|
||||||
(watch [_ _ stream]
|
(watch [_ _ stream]
|
||||||
(let [team-id (:id team)
|
(let [team-id (:id team)
|
||||||
file-id (:id file)
|
file-id (:id file)
|
||||||
stoper-s (rx/filter (ptk/type? ::bundle-fetched) stream)]
|
stopper (rx/filter (ptk/type? ::bundle-fetched) stream)]
|
||||||
|
|
||||||
(->> (rx/concat
|
(->> (rx/concat
|
||||||
;; Initialize notifications
|
;; Initialize notifications
|
||||||
|
@ -204,7 +203,7 @@
|
||||||
|
|
||||||
(rx/of (with-meta (workspace-initialized)
|
(rx/of (with-meta (workspace-initialized)
|
||||||
{:file-id file-id})))
|
{:file-id file-id})))
|
||||||
(rx/take-until stoper-s))))))
|
(rx/take-until stopper))))))
|
||||||
|
|
||||||
(defn- libraries-fetched
|
(defn- libraries-fetched
|
||||||
[libraries]
|
[libraries]
|
||||||
|
@ -2138,7 +2137,6 @@
|
||||||
(watch [_ _ _]
|
(watch [_ _ _]
|
||||||
(if read-only?
|
(if read-only?
|
||||||
(rx/of :interrupt
|
(rx/of :interrupt
|
||||||
(dwdc/clear-drawing)
|
|
||||||
(remove-layout-flag :colorpalette)
|
(remove-layout-flag :colorpalette)
|
||||||
(remove-layout-flag :textpalette))
|
(remove-layout-flag :textpalette))
|
||||||
(rx/empty)))))
|
(rx/empty)))))
|
||||||
|
|
|
@ -526,9 +526,9 @@
|
||||||
(ptk/reify ::initialize-colorpicker
|
(ptk/reify ::initialize-colorpicker
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ stream]
|
(watch [_ _ stream]
|
||||||
(let [stoper (rx/merge
|
(let [stopper (rx/merge
|
||||||
(rx/filter (ptk/type? ::finalize-colorpicker) stream)
|
(rx/filter (ptk/type? ::finalize-colorpicker) stream)
|
||||||
(rx/filter (ptk/type? ::initialize-colorpicker) stream))]
|
(rx/filter (ptk/type? ::initialize-colorpicker) stream))]
|
||||||
|
|
||||||
(->> (rx/merge
|
(->> (rx/merge
|
||||||
(->> stream
|
(->> stream
|
||||||
|
@ -537,7 +537,7 @@
|
||||||
(rx/filter (ptk/type? ::update-colorpicker-color) stream)
|
(rx/filter (ptk/type? ::update-colorpicker-color) stream)
|
||||||
(rx/filter (ptk/type? ::activate-colorpicker-gradient) stream))
|
(rx/filter (ptk/type? ::activate-colorpicker-gradient) stream))
|
||||||
(rx/map (constantly (colorpicker-onchange-runner on-change)))
|
(rx/map (constantly (colorpicker-onchange-runner on-change)))
|
||||||
(rx/take-until stoper))))
|
(rx/take-until stopper))))
|
||||||
|
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
(ptk/reify ::initialize-comments
|
(ptk/reify ::initialize-comments
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ stream]
|
(watch [_ _ stream]
|
||||||
(let [stoper (rx/filter #(= ::finalize %) stream)]
|
(let [stopper (rx/filter #(= ::finalize %) stream)]
|
||||||
(rx/merge
|
(rx/merge
|
||||||
(rx/of (dcm/retrieve-comment-threads file-id))
|
(rx/of (dcm/retrieve-comment-threads file-id))
|
||||||
(->> stream
|
(->> stream
|
||||||
|
@ -45,11 +45,11 @@
|
||||||
(rx/filter (fn [[_ space]] (not space)))
|
(rx/filter (fn [[_ space]] (not space)))
|
||||||
(rx/map first)
|
(rx/map first)
|
||||||
(rx/map handle-comment-layer-click)
|
(rx/map handle-comment-layer-click)
|
||||||
(rx/take-until stoper))
|
(rx/take-until stopper))
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter dwco/interrupt?)
|
(rx/filter dwco/interrupt?)
|
||||||
(rx/map handle-interrupt)
|
(rx/map handle-interrupt)
|
||||||
(rx/take-until stoper)))))))
|
(rx/take-until stopper)))))))
|
||||||
|
|
||||||
(defn- handle-interrupt
|
(defn- handle-interrupt
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -78,12 +78,12 @@
|
||||||
(ptk/reify ::handle-drawing
|
(ptk/reify ::handle-drawing
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [stoper (rx/merge
|
(let [stopper (rx/merge
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter mse/mouse-event?)
|
(rx/filter mse/mouse-event?)
|
||||||
(rx/filter mse/mouse-up-event?))
|
(rx/filter mse/mouse-up-event?))
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter #(= % :interrupt))))
|
(rx/filter #(= % :interrupt))))
|
||||||
|
|
||||||
layout (get state :workspace-layout)
|
layout (get state :workspace-layout)
|
||||||
zoom (dm/get-in state [:workspace-local :zoom] 1)
|
zoom (dm/get-in state [:workspace-local :zoom] 1)
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
(rx/filter #(> (gpt/distance % initial) (/ 2 zoom)))
|
(rx/filter #(> (gpt/distance % initial) (/ 2 zoom)))
|
||||||
;; Take until before the snap calculation otherwise we could cancel the snap in the worker
|
;; Take until before the snap calculation otherwise we could cancel the snap in the worker
|
||||||
;; and its a problem for fast moving drawing
|
;; and its a problem for fast moving drawing
|
||||||
(rx/take-until stoper)
|
(rx/take-until stopper)
|
||||||
(rx/with-latest-from ms/mouse-position-shift ms/mouse-position-mod)
|
(rx/with-latest-from ms/mouse-position-shift ms/mouse-position-mod)
|
||||||
(rx/switch-map
|
(rx/switch-map
|
||||||
(fn [[point :as current]]
|
(fn [[point :as current]]
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
(def simplify-tolerance 0.3)
|
(def simplify-tolerance 0.3)
|
||||||
|
|
||||||
(defn stoper-event?
|
(defn stopper-event?
|
||||||
[{:keys [type] :as event}]
|
[{:keys [type] :as event}]
|
||||||
(and (mse/mouse-event? event)
|
(and (mse/mouse-event? event)
|
||||||
(= type :up)))
|
(= type :up)))
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
(ptk/reify ::handle-drawing
|
(ptk/reify ::handle-drawing
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ stream]
|
(watch [_ _ stream]
|
||||||
(let [stoper (rx/filter stoper-event? stream)
|
(let [stopper (rx/filter stopper-event? stream)
|
||||||
mouse (rx/sample 10 ms/mouse-position)
|
mouse (rx/sample 10 ms/mouse-position)
|
||||||
shape (cts/setup-shape {:type :path
|
shape (cts/setup-shape {:type :path
|
||||||
:initialized? true
|
:initialized? true
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
(rx/of #(update % :workspace-drawing assoc :object shape))
|
(rx/of #(update % :workspace-drawing assoc :object shape))
|
||||||
(->> mouse
|
(->> mouse
|
||||||
(rx/map insert-point)
|
(rx/map insert-point)
|
||||||
(rx/take-until stoper))
|
(rx/take-until stopper))
|
||||||
(rx/of
|
(rx/of
|
||||||
(setup-frame)
|
(setup-frame)
|
||||||
(finish-drawing)
|
(finish-drawing)
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
(ptk/reify ::initialize
|
(ptk/reify ::initialize
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [stoper (rx/filter (ptk/type? ::finalize) stream)
|
(let [stopper (rx/filter (ptk/type? ::finalize) stream)
|
||||||
profile-id (:profile-id state)
|
profile-id (:profile-id state)
|
||||||
|
|
||||||
initmsg [{:type :subscribe-file
|
initmsg [{:type :subscribe-file
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
(rx/pipe (rxs/throttle 100))
|
(rx/pipe (rxs/throttle 100))
|
||||||
(rx/map #(handle-pointer-send file-id (:pt %)))))
|
(rx/map #(handle-pointer-send file-id (:pt %)))))
|
||||||
|
|
||||||
(rx/take-until stoper))]
|
(rx/take-until stopper))]
|
||||||
|
|
||||||
(rx/concat stream (rx/of (dws/send endmsg)))))))
|
(rx/concat stream (rx/of (dws/send endmsg)))))))
|
||||||
|
|
||||||
|
|
|
@ -120,12 +120,12 @@
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [zoom (get-in state [:workspace-local :zoom] 1)
|
(let [zoom (get-in state [:workspace-local :zoom] 1)
|
||||||
stoper (rx/merge
|
stopper (rx/merge
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter mse/mouse-event?)
|
(rx/filter mse/mouse-event?)
|
||||||
(rx/filter mse/mouse-up-event?))
|
(rx/filter mse/mouse-up-event?))
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter dwc/interrupt?)))
|
(rx/filter dwc/interrupt?)))
|
||||||
|
|
||||||
from-p @ms/mouse-position]
|
from-p @ms/mouse-position]
|
||||||
(rx/concat
|
(rx/concat
|
||||||
|
@ -133,7 +133,7 @@
|
||||||
(rx/map #(grc/points->rect [from-p %]))
|
(rx/map #(grc/points->rect [from-p %]))
|
||||||
(rx/filter (partial valid-rect? zoom))
|
(rx/filter (partial valid-rect? zoom))
|
||||||
(rx/map update-area-selection)
|
(rx/map update-area-selection)
|
||||||
(rx/take-until stoper))
|
(rx/take-until stopper))
|
||||||
|
|
||||||
(rx/of (select-node-area shift?)
|
(rx/of (select-node-area shift?)
|
||||||
(clear-area-selection))))))))
|
(clear-area-selection))))))))
|
||||||
|
|
|
@ -52,19 +52,19 @@
|
||||||
|
|
||||||
start (-> @ms/mouse-position to-pixel-snap)
|
start (-> @ms/mouse-position to-pixel-snap)
|
||||||
|
|
||||||
stoper (rx/merge
|
stopper (rx/merge
|
||||||
(->> st/stream
|
(->> st/stream
|
||||||
(rx/filter mse/mouse-event?)
|
(rx/filter mse/mouse-event?)
|
||||||
(rx/filter mse/mouse-up-event?))
|
(rx/filter mse/mouse-up-event?))
|
||||||
(->> st/stream
|
(->> st/stream
|
||||||
(rx/filter finish-edition?)))
|
(rx/filter finish-edition?)))
|
||||||
|
|
||||||
position-stream
|
position-stream
|
||||||
(->> ms/mouse-position
|
(->> ms/mouse-position
|
||||||
(rx/map to-pixel-snap)
|
(rx/map to-pixel-snap)
|
||||||
(rx/filter (dragging? start zoom))
|
(rx/filter (dragging? start zoom))
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/take-until stoper))]
|
(rx/take-until stopper))]
|
||||||
|
|
||||||
(rx/merge
|
(rx/merge
|
||||||
(->> position-stream
|
(->> position-stream
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ stream]
|
(watch [_ _ stream]
|
||||||
(log/debug :hint "initialize persistence")
|
(log/debug :hint "initialize persistence")
|
||||||
(let [stoper (rx/filter (ptk/type? ::initialize-persistence) stream)
|
(let [stopper (rx/filter (ptk/type? ::initialize-persistence) stream)
|
||||||
commits (l/atom [])
|
commits (l/atom [])
|
||||||
saving? (l/atom false)
|
saving? (l/atom false)
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
|
|
||||||
on-dirty
|
on-dirty
|
||||||
(fn []
|
(fn []
|
||||||
;; Enable reload stoper
|
;; Enable reload stopper
|
||||||
(swap! st/ongoing-tasks conj :workspace-change)
|
(swap! st/ongoing-tasks conj :workspace-change)
|
||||||
(st/emit! (update-persistence-status {:status :pending})))
|
(st/emit! (update-persistence-status {:status :pending})))
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
on-saved
|
on-saved
|
||||||
(fn []
|
(fn []
|
||||||
;; Disable reload stoper
|
;; Disable reload stopper
|
||||||
(swap! st/ongoing-tasks disj :workspace-change)
|
(swap! st/ongoing-tasks disj :workspace-change)
|
||||||
(st/emit! (update-persistence-status {:status :saved}))
|
(st/emit! (update-persistence-status {:status :saved}))
|
||||||
(reset! saving? false))]
|
(reset! saving? false))]
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
(assoc :file-id file-id))))
|
(assoc :file-id file-id))))
|
||||||
(rx/observe-on :async)
|
(rx/observe-on :async)
|
||||||
(rx/tap #(swap! commits conj %))
|
(rx/tap #(swap! commits conj %))
|
||||||
(rx/take-until (rx/delay 100 stoper))
|
(rx/take-until (rx/delay 100 stopper))
|
||||||
(rx/finalize (fn []
|
(rx/finalize (fn []
|
||||||
(log/debug :hint "finalize persistence: changes watcher"))))
|
(log/debug :hint "finalize persistence: changes watcher"))))
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
(rx/tap on-saved)
|
(rx/tap on-saved)
|
||||||
(rx/ignore)))
|
(rx/ignore)))
|
||||||
(rx/empty))))
|
(rx/empty))))
|
||||||
(rx/take-until (rx/delay 100 stoper))
|
(rx/take-until (rx/delay 100 stopper))
|
||||||
(rx/finalize (fn []
|
(rx/finalize (fn []
|
||||||
(log/debug :hint "finalize persistence: save loop"))))
|
(log/debug :hint "finalize persistence: save loop"))))
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@
|
||||||
(rx/filter library-file?)
|
(rx/filter library-file?)
|
||||||
(rx/filter (complement #(empty? (:changes %))))
|
(rx/filter (complement #(empty? (:changes %))))
|
||||||
(rx/map persist-synchronous-changes)
|
(rx/map persist-synchronous-changes)
|
||||||
(rx/take-until (rx/delay 100 stoper))
|
(rx/take-until (rx/delay 100 stopper))
|
||||||
(rx/finalize (fn []
|
(rx/finalize (fn []
|
||||||
(log/debug :hint "finalize persistence: synchronous save loop")))))))))
|
(log/debug :hint "finalize persistence: synchronous save loop")))))))))
|
||||||
|
|
||||||
|
|
|
@ -64,12 +64,12 @@
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [zoom (dm/get-in state [:workspace-local :zoom] 1)
|
(let [zoom (dm/get-in state [:workspace-local :zoom] 1)
|
||||||
stoper (rx/merge
|
stopper (rx/merge
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter mse/mouse-event?)
|
(rx/filter mse/mouse-event?)
|
||||||
(rx/filter mse/mouse-up-event?))
|
(rx/filter mse/mouse-up-event?))
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter interrupt?)))
|
(rx/filter interrupt?)))
|
||||||
|
|
||||||
init-position @ms/mouse-position
|
init-position @ms/mouse-position
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
(rx/scan calculate-selrect init-selrect)
|
(rx/scan calculate-selrect init-selrect)
|
||||||
(rx/filter #(or (> (dm/get-prop % :width) (/ 10 zoom))
|
(rx/filter #(or (> (dm/get-prop % :width) (/ 10 zoom))
|
||||||
(> (dm/get-prop % :height) (/ 10 zoom))))
|
(> (dm/get-prop % :height) (/ 10 zoom))))
|
||||||
(rx/take-until stoper))]
|
(rx/take-until stopper))]
|
||||||
|
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(if preserve?
|
(if preserve?
|
||||||
|
@ -667,9 +667,9 @@
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ stream]
|
(watch [_ _ stream]
|
||||||
(let [stoper (rx/filter (ptk/type? ::memorize-duplicated) stream)]
|
(let [stopper (rx/filter (ptk/type? ::memorize-duplicated) stream)]
|
||||||
(->> (rx/timer 10000) ;; This time may be adjusted after some user testing.
|
(->> (rx/timer 10000) ;; This time may be adjusted after some user testing.
|
||||||
(rx/take-until stoper)
|
(rx/take-until stopper)
|
||||||
(rx/map clear-memorize-duplicated))))))
|
(rx/map clear-memorize-duplicated))))))
|
||||||
|
|
||||||
(defn calc-duplicate-delta
|
(defn calc-duplicate-delta
|
||||||
|
|
|
@ -370,9 +370,9 @@
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ stream]
|
(watch [_ _ stream]
|
||||||
(let [stoper (->> stream
|
(let [stopper (->> stream
|
||||||
(rx/filter mse/mouse-event?)
|
(rx/filter mse/mouse-event?)
|
||||||
(rx/filter mse/mouse-up-event?))
|
(rx/filter mse/mouse-up-event?))
|
||||||
|
|
||||||
group (gsh/shapes->rect shapes)
|
group (gsh/shapes->rect shapes)
|
||||||
group-center (grc/rect->center group)
|
group-center (grc/rect->center group)
|
||||||
|
@ -399,7 +399,7 @@
|
||||||
(fn [[pos mod? shift?]]
|
(fn [[pos mod? shift?]]
|
||||||
(let [delta-angle (calculate-angle pos mod? shift?)]
|
(let [delta-angle (calculate-angle pos mod? shift?)]
|
||||||
(dwm/set-rotation-modifiers delta-angle shapes group-center))))
|
(dwm/set-rotation-modifiers delta-angle shapes group-center))))
|
||||||
(rx/take-until stoper))
|
(rx/take-until stopper))
|
||||||
(rx/of (dwm/apply-modifiers)
|
(rx/of (dwm/apply-modifiers)
|
||||||
(finish-transform)))))))
|
(finish-transform)))))))
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
|
|
||||||
ptk/EffectEvent
|
ptk/EffectEvent
|
||||||
(effect [_ state stream]
|
(effect [_ state stream]
|
||||||
(let [stoper (rx/filter (ptk/type? ::initialize-history) stream)
|
(let [stopper (rx/filter (ptk/type? ::initialize-history) stream)
|
||||||
history (:history state)
|
history (:history state)
|
||||||
router (:router state)]
|
router (:router state)]
|
||||||
(ts/schedule #(on-change router (.getToken ^js history)))
|
(ts/schedule #(on-change router (.getToken ^js history)))
|
||||||
|
@ -158,5 +158,5 @@
|
||||||
(fn []
|
(fn []
|
||||||
(bhistory/disable! history)
|
(bhistory/disable! history)
|
||||||
(e/unlistenByKey key)))))
|
(e/unlistenByKey key)))))
|
||||||
(rx/take-until stoper)
|
(rx/take-until stopper)
|
||||||
(rx/subs! #(on-change router %)))))))
|
(rx/subs! #(on-change router %)))))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue