Skip to content
New issue

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

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

Already on GitHub? # to your account

♻️ Add shift canvas when enlarge #226

Merged
merged 2 commits into from
Dec 10, 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
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class ImageLabellingSegmentationComponent implements OnInit, OnChanges, O
mouseEvent: MouseEvent | undefined;
labelColorList!: Map<string, string>;
invalidInput: boolean = false;
intervalId!: NodeJS.Timeout;
@Input() _selectMetadata!: PolyMetadata;
@Input() _imgSrc: string = '';
@Input() _tabStatus: TabsProps<CompleteMetadata>[] = [];
Expand Down Expand Up @@ -367,6 +368,28 @@ export class ImageLabellingSegmentationComponent implements OnInit, OnChanges, O
this.movePolygon(key);
}

if (ctrlKey) {
this._imgLblStateService.setState({ draw: false, drag: true, scroll: true });
this.intervalId = setInterval(() => {
this._segCanvasService.panPolygons(this._selectMetadata, true, () => {
/** This is intentional */
});
this._segCanvasService.drawNewPolygon(
this._selectMetadata,
this.image,
this.canvasContext,
this.canvas.nativeElement,
false,
);
}, 100);
}

if (key === 'x' || key === 'X') {
clearInterval(this.intervalId);
this._segCanvasService.setGlobalXY(this.mouseEvent as ExtendedMouseEvent);
this._imgLblStateService.setState({ draw: true, drag: false, scroll: false });
}

if (this._shortcutKeyService.checkKey(ctrlKey, metaKey, shiftKey, key, 'copy')) {
this.copyPolygon();
} else if (this._shortcutKeyService.checkKey(ctrlKey, metaKey, shiftKey, key, 'paste')) {
Expand All @@ -380,7 +403,6 @@ export class ImageLabellingSegmentationComponent implements OnInit, OnChanges, O
this.undoAction();
}
}
// }
} catch (err) {
console.log('canvasKeyDownEvent', err);
}
Expand Down