enhance: only sort selection blocks when mouse up

This commit is contained in:
Tienson Qin
2021-06-15 20:55:44 +08:00
parent 100b3ee0e8
commit 76f2e514e2
2 changed files with 15 additions and 6 deletions

View File

@@ -551,11 +551,18 @@
(set-selection-blocks! blocks :down))
([blocks direction]
(when (seq blocks)
(let [blocks (util/sort-by-height blocks)]
(swap! state assoc
:selection/mode true
:selection/blocks blocks
:selection/direction direction)))))
(swap! state assoc
:selection/mode true
:selection/blocks blocks
:selection/direction direction))))
(defn sort-selection-blocks!
[]
(when (:selection/mode @state)
(swap! state update :selection/blocks
(fn [blocks]
(when (seq blocks)
(util/sort-by-height blocks))))))
(defn into-selection-mode!
[]