diff --git a/cvat-canvas/src/typescript/canvasView.ts b/cvat-canvas/src/typescript/canvasView.ts index 791a26186ab0..9cd354a9b5d8 100644 --- a/cvat-canvas/src/typescript/canvasView.ts +++ b/cvat-canvas/src/typescript/canvasView.ts @@ -754,25 +754,37 @@ export class CanvasViewImpl implements CanvasView, Listener { } else if (reason === UpdateReasons.DRAW) { const data: DrawData = this.controller.drawData; if (data.enabled) { + this.canvas.style.cursor = 'crosshair'; this.mode = Mode.DRAW; + } else { + this.canvas.style.cursor = ''; } this.drawHandler.draw(data, this.geometry); } else if (reason === UpdateReasons.MERGE) { const data: MergeData = this.controller.mergeData; if (data.enabled) { + this.canvas.style.cursor = 'copy'; this.mode = Mode.MERGE; + } else { + this.canvas.style.cursor = ''; } this.mergeHandler.merge(data); } else if (reason === UpdateReasons.SPLIT) { const data: SplitData = this.controller.splitData; if (data.enabled) { + this.canvas.style.cursor = 'copy'; this.mode = Mode.SPLIT; + } else { + this.canvas.style.cursor = ''; } this.splitHandler.split(data); } else if (reason === UpdateReasons.GROUP) { const data: GroupData = this.controller.groupData; if (data.enabled) { + this.canvas.style.cursor = 'copy'; this.mode = Mode.GROUP; + } else { + this.canvas.style.cursor = ''; } this.groupHandler.group(data); } else if (reason === UpdateReasons.SELECT) { diff --git a/cvat-canvas/src/typescript/splitHandler.ts b/cvat-canvas/src/typescript/splitHandler.ts index 46e5b646fa49..6a0b8a5c4dea 100644 --- a/cvat-canvas/src/typescript/splitHandler.ts +++ b/cvat-canvas/src/typescript/splitHandler.ts @@ -27,13 +27,13 @@ export class SplitHandlerImpl implements SplitHandler { private release(): void { if (this.initialized) { this.resetShape(); - this.canvas.node.removeEventListener('mousemove', this.onFindObject); + this.canvas.node.removeEventListener('mousemove', this.findObject); this.initialized = false; } } private initSplitting(): void { - this.canvas.node.addEventListener('mousemove', this.onFindObject); + this.canvas.node.addEventListener('mousemove', this.findObject); this.initialized = true; this.splitDone = false; } @@ -47,6 +47,11 @@ export class SplitHandlerImpl implements SplitHandler { this.release(); } + private findObject = (e: MouseEvent): void => { + this.resetShape(); + this.onFindObject(e); + }; + public constructor( onSplitDone: (object: any) => void, onFindObject: (event: MouseEvent) => void, @@ -83,8 +88,6 @@ export class SplitHandlerImpl implements SplitHandler { once: true, }); } - } else { - this.resetShape(); } }