Skip to content

Commit 9372d9e

Browse files
committed
fix: use 50% cell width as drag threshold to scale with font size
1 parent 817b0c2 commit 9372d9e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/selection-manager.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export class SelectionManager {
4343
private selectionStart: { col: number; absoluteRow: number } | null = null;
4444
private selectionEnd: { col: number; absoluteRow: number } | null = null;
4545
private isSelecting: boolean = false;
46-
private static readonly DRAG_THRESHOLD_PX = 5;
4746
private mouseDownX: number = 0;
4847
private mouseDownY: number = 0;
4948
private dragThresholdMet: boolean = false;
@@ -470,10 +469,9 @@ export class SelectionManager {
470469
if (!this.dragThresholdMet) {
471470
const dx = e.offsetX - this.mouseDownX;
472471
const dy = e.offsetY - this.mouseDownY;
473-
if (
474-
dx * dx + dy * dy <
475-
SelectionManager.DRAG_THRESHOLD_PX * SelectionManager.DRAG_THRESHOLD_PX
476-
) {
472+
// Use 50% of cell width as threshold to scale with font size
473+
const threshold = this.renderer.getMetrics().width * 0.5;
474+
if (dx * dx + dy * dy < threshold * threshold) {
477475
return; // Below threshold, ignore
478476
}
479477
this.dragThresholdMet = true;

0 commit comments

Comments
 (0)