diff --git a/frontend/app.vue b/frontend/app.vue index 0baa0b5..8c3ae40 100644 --- a/frontend/app.vue +++ b/frontend/app.vue @@ -20,6 +20,7 @@ body, #__layout { width: 100%; height: 100%; + overflow: hidden; } * { diff --git a/frontend/components/SelectionRect.vue b/frontend/components/SelectionRect.vue index 2abc65b..53ff10b 100644 --- a/frontend/components/SelectionRect.vue +++ b/frontend/components/SelectionRect.vue @@ -8,6 +8,10 @@ const width = computed(() => Math.abs(rect.a.x - rect.b.x)); const height = computed(() => Math.abs(rect.a.y - rect.b.y)); function onDocumentPointerDown(e: MouseEvent) { + if (e.button !== 0) { + return; + } + const point = { x: e.x, y: e.y }; rect.set( point, @@ -17,12 +21,16 @@ function onDocumentPointerDown(e: MouseEvent) { } function onDocumentPointerMove(e: MouseEvent) { + if (!rect.enabled) { + return; + } + rect.updateB(e.x, e.y); if ( rect.mode !== 'set' || - !rect.enabled || - warrenStore.selection.size === 0 + warrenStore.selection.size === 0 || + !rect.isMinSize() ) { return; } @@ -30,22 +38,24 @@ function onDocumentPointerMove(e: MouseEvent) { warrenStore.clearSelection(); } -function onDocumentPointerUp() { +function onDocumentPointerUp(e: MouseEvent) { + if (e.button !== 0 || !rect.enabled) { + return; + } + rect.disable(); if (warrenStore.current == null || warrenStore.current.dir == null) { return; } - const start = rect.a; - const end = rect.b; - - const left = Math.min(start.x, end.x); - const top = Math.min(start.y, end.y); - const width = Math.abs(start.x - end.x); - const height = Math.abs(start.y - end.y); + const left = Math.min(rect.a.x, rect.b.x); + const top = Math.min(rect.a.y, rect.b.y); + const width = Math.abs(rect.a.x - rect.b.x); + const height = Math.abs(rect.a.y - rect.b.y); if (!rect.isMinSize()) { + warrenStore.clearSelection(); return; } @@ -72,8 +82,6 @@ function onDocumentPointerUp() { } } - rect.dirty = true; - if (rect.mode === 'set') { warrenStore.setSelection(targetEntries); } else if (rect.mode === 'add') { diff --git a/frontend/pages/share.vue b/frontend/pages/share.vue index f657cac..2213bf1 100644 --- a/frontend/pages/share.vue +++ b/frontend/pages/share.vue @@ -184,22 +184,12 @@ function onEntryDownload(entry: DirectoryEntry) { downloadFile(downloadName, downloadApiUrl); } - -function onParentClick() { - if (selectionRect.dirty) { - selectionRect.dirty = false; - return; - } - - warrenStore.clearSelection(); -}