Skip to content

Commit bf1a07f

Browse files
committed
fix: apply drag threshold in document-level mousemove to prevent discarding fast edge drags
1 parent a3fb59a commit bf1a07f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/selection-manager.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,17 @@ export class SelectionManager {
513513
// Document-level mousemove for tracking mouse position during drag outside canvas
514514
this.boundDocumentMouseMoveHandler = (e: MouseEvent) => {
515515
if (this.isSelecting) {
516+
// Check drag threshold (same as canvas mousemove)
517+
if (!this.dragThresholdMet) {
518+
const dx = e.clientX - (canvas.getBoundingClientRect().left + this.mouseDownX);
519+
const dy = e.clientY - (canvas.getBoundingClientRect().top + this.mouseDownY);
520+
const threshold = this.renderer.getMetrics().width * 0.5;
521+
if (dx * dx + dy * dy < threshold * threshold) {
522+
return;
523+
}
524+
this.dragThresholdMet = true;
525+
}
526+
516527
const rect = canvas.getBoundingClientRect();
517528

518529
// Update selection based on clamped position

0 commit comments

Comments
 (0)