Skip to content

Commit e2fafc2

Browse files
fix(ui): select obj box moving on mmb pan
1 parent f7d372c commit e2fafc2

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

invokeai/frontend/web/src/features/controlLayers/konva/CanvasSegmentAnythingModule.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,9 @@ export class CanvasSegmentAnythingModule extends CanvasModuleBase {
436436
});
437437

438438
// Handle manual drag detection for bbox rect
439-
this.konva.bboxRect.on('mousedown touchstart', (e) => {
440-
// Only handle left mouse button (0) or touch events
441-
// For mouse events, evt.button exists; for touch events, it doesn't
442-
if ('button' in e.evt && e.evt.button !== 0) {
439+
this.konva.bboxRect.on('pointerdown', (e) => {
440+
// Only handle left mouse button - other buttons are for panning or context menu
441+
if (e.evt.button !== 0) {
443442
return;
444443
}
445444

@@ -464,9 +463,9 @@ export class CanvasSegmentAnythingModule extends CanvasModuleBase {
464463
});
465464

466465
// Handle transformer interactions
467-
this.konva.bboxTransformer.on('mousedown touchstart', (e) => {
468-
// Only handle left mouse button (0) or touch events
469-
if ('button' in e.evt && e.evt.button !== 0) {
466+
this.konva.bboxTransformer.on('pointerdown', (e) => {
467+
// Only handle left mouse button - other buttons are for panning or context menu
468+
if (e.evt.button !== 0) {
470469
return;
471470
}
472471

@@ -629,7 +628,7 @@ export class CanvasSegmentAnythingModule extends CanvasModuleBase {
629628
return;
630629
}
631630

632-
// Only handle left-clicks (button 0). Ignore middle (1) and right (2) clicks
631+
// Only handle left mouse button - other buttons are for panning or context menu
633632
if (e.evt.button !== 0) {
634633
return;
635634
}
@@ -732,7 +731,7 @@ export class CanvasSegmentAnythingModule extends CanvasModuleBase {
732731

733732
// Handle visual mode
734733
if (data.type === 'visual') {
735-
// Only handle left-clicks (button 0). Ignore middle (1) and right (2) clicks
734+
// Only handle left mouse button - other buttons are for panning or context menu
736735
if (e.evt.button !== 0) {
737736
return;
738737
}
@@ -888,7 +887,7 @@ export class CanvasSegmentAnythingModule extends CanvasModuleBase {
888887
* Handles mouse/touch up for manual bbox dragging
889888
*/
890889
onBboxDragEnd = (e: KonvaEventObject<PointerEvent>) => {
891-
// Only handle left-clicks (button 0). Ignore middle (1) and right (2) clicks
890+
// Only handle left mouse button - other buttons are for panning or context menu
892891
if (e.evt.button !== 0) {
893892
return;
894893
}

0 commit comments

Comments
 (0)