Skip to content

Commit

Permalink
enhance cancel event
Browse files Browse the repository at this point in the history
  • Loading branch information
sprocketc committed Feb 8, 2024
1 parent c391fd5 commit 68ac2c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/renderer/history/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,18 @@
:history/cancel
(fn [db _]
(cond-> db
(and (= (:tool db) :select) (not (:pointer-offset db)))
(and (= (:tool db) :select) (= (:state db) :default))
(-> element.h/deselect
(h/finalize "Deselect all"))

(not (:pointer-offset db))
(-> (tools/set-tool :select)
(assoc :state :default))
(= (:state db) :select)
(element.h/clear-hovered)

(= (:state db) :default)
(tools/set-tool :select)

:always (-> (dissoc :pointer-offset)
(dissoc :drag?)
(assoc :state :default)
element.h/clear-temp
h/swap))))
4 changes: 1 addition & 3 deletions src/renderer/tools/select.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@

(defmethod tools/deactivate :select
[db]
(-> db
element.h/clear-hovered
(element.h/clear-ignored)))
(element.h/clear-ignored db))

(defn select-rect
[{:keys [adjusted-pointer-offset
Expand Down

0 comments on commit 68ac2c5

Please sign in to comment.