Skip to content

Commit 750568b

Browse files
committed
fix double click timestamp check
1 parent 9f2323e commit 750568b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/renderer/app/db.cljs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
utils.i18n/lang?])
2828

2929
(def App
30-
[:map {:closed true}
30+
[:map
3131
[:tool {:default :transform} Tool]
3232
[:primary-tool {:optional true} Tool]
3333
[:pointer-pos {:default [0 0]} Vec2]
@@ -39,7 +39,7 @@
3939
[:nearest-neighbors {:optional true} [:sequential NearestNeighbor]]
4040
[:drag {:optional true} boolean?]
4141
[:zoom-sensitivity {:default 0.75} [:and number? pos?]]
42-
[:event-time {:optional true} number?]
42+
[:event-timestamp {:optional true} number?]
4343
[:double-click-delta {:default 250} [:and number? pos?]]
4444
[:state {:default :idle} State]
4545
[:grid {:default false :persist true} boolean?]

src/renderer/event/handlers.cljs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@
6565
(tool.handlers/add-fx [::event.effects/release-pointer-capture pointer-id]))
6666
(if (= button :right)
6767
db
68-
(if (> (- timestamp (:event-time db)) (:double-click-delta db))
69-
(-> (assoc db :event-time timestamp)
70-
(tool.hierarchy/on-pointer-up e))
71-
(tool.hierarchy/on-double-click db e))))
68+
(if (< 0 (- timestamp (:event-timestamp db)) (:double-click-delta db))
69+
(-> (dissoc db :event-timestamp)
70+
(tool.hierarchy/on-double-click e))
71+
(-> (assoc db :event-timestamp timestamp)
72+
(tool.hierarchy/on-pointer-up e)))))
7273
(and primary-tool (= button :middle))
7374
(-> (tool.handlers/activate primary-tool)
7475
(dissoc :primary-tool))

0 commit comments

Comments
 (0)