Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix intelligent scissors blocking #3825

Merged
merged 2 commits into from
Oct 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion cvat-canvas/src/typescript/interactionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,33 @@ export interface InteractionHandler {

export class InteractionHandlerImpl implements InteractionHandler {
private onInteraction: (shapes: InteractionResult[] | null, shapesUpdated?: boolean, isDone?: boolean) => void;

private configuration: Configuration;

private geometry: Geometry;

private canvas: SVG.Container;

private interactionData: InteractionData;

private cursorPosition: { x: number; y: number };

private shapesWereUpdated: boolean;

private interactionShapes: SVG.Shape[];

private currentInteractionShape: SVG.Shape | null;

private crosshair: Crosshair;

private threshold: SVG.Rect | null;

private thresholdRectSize: number;

private intermediateShape: PropType<InteractionData, 'intermediateShape'>;

private drawnIntermediateShape: SVG.Shape;

private thresholdWasModified: boolean;

private prepareResult(): InteractionResult[] {
Expand Down Expand Up @@ -310,6 +324,7 @@ export class InteractionHandlerImpl implements InteractionHandler {
}

private selectize(value: boolean, shape: SVG.Element, erroredShape = false): void {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;

if (value) {
Expand Down Expand Up @@ -450,7 +465,7 @@ export class InteractionHandlerImpl implements InteractionHandler {
});

window.addEventListener('keydown', (e: KeyboardEvent): void => {
if (this.interactionData.enabled && e.keyCode === 17) {
if (!e.repeat && this.interactionData.enabled && e.keyCode === 17) {
if (this.interactionData.onChangeToolsBlockerState && !this.thresholdWasModified) {
this.interactionData.onChangeToolsBlockerState('keydown');
}
Expand Down