mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-09-02 00:32:33 +00:00
handle series of (de)select events together
This commit is contained in:
@@ -48,8 +48,15 @@
|
|||||||
let sortable: Sortable;
|
let sortable: Sortable;
|
||||||
let orientation = getContext<'vertical' | 'horizontal'>('orientation');
|
let orientation = getContext<'vertical' | 'horizontal'>('orientation');
|
||||||
|
|
||||||
|
let lastUpdateStart = 0;
|
||||||
function updateToSelection(e) {
|
function updateToSelection(e) {
|
||||||
if (updating) return;
|
lastUpdateStart = Date.now();
|
||||||
|
setTimeout(() => {
|
||||||
|
if (Date.now() - lastUpdateStart >= 40) {
|
||||||
|
if (updating) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
updating = true;
|
updating = true;
|
||||||
// Sortable updates selection
|
// Sortable updates selection
|
||||||
let changed = getChangedIds();
|
let changed = getChangedIds();
|
||||||
@@ -78,6 +85,8 @@
|
|||||||
}
|
}
|
||||||
updating = false;
|
updating = false;
|
||||||
}
|
}
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
function updateFromSelection() {
|
function updateFromSelection() {
|
||||||
if (updating) return;
|
if (updating) return;
|
||||||
|
Reference in New Issue
Block a user