Fixed grouping when press escape with drawn region or change a frame

main
Boris Sekachev 5 years ago
parent 6f3c0cb4f3
commit fcea8f8d30

@ -35,11 +35,11 @@ export class GroupHandlerImpl implements GroupHandler {
private getSelectionBox( private getSelectionBox(
event: MouseEvent, event: MouseEvent,
): { ): {
xtl: number; xtl: number;
ytl: number; ytl: number;
xbr: number; xbr: number;
ybr: number; ybr: number;
} { } {
const point = translateToSVG((this.canvas.node as any) as SVGSVGElement, [event.clientX, event.clientY]); const point = translateToSVG((this.canvas.node as any) as SVGSVGElement, [event.clientX, event.clientY]);
const stopSelectionPoint = { const stopSelectionPoint = {
x: point[0], x: point[0],
@ -96,11 +96,11 @@ export class GroupHandlerImpl implements GroupHandler {
const bbox = shape.bbox(); const bbox = shape.bbox();
const clientID = shape.attr('clientID'); const clientID = shape.attr('clientID');
if ( if (
bbox.x > box.xtl && bbox.x > box.xtl
bbox.y > box.ytl && && bbox.y > box.ytl
bbox.x + bbox.width < box.xbr && && bbox.x + bbox.width < box.xbr
bbox.y + bbox.height < box.ybr && && bbox.y + bbox.height < box.ybr
!(clientID in this.highlightedShapes) && !(clientID in this.highlightedShapes)
) { ) {
const objectState = this.getStates().filter( const objectState = this.getStates().filter(
(state: any): boolean => state.clientID === clientID, (state: any): boolean => state.clientID === clientID,
@ -124,7 +124,6 @@ export class GroupHandlerImpl implements GroupHandler {
this.resetSelectedObjects(); this.resetSelectedObjects();
this.initialized = false; this.initialized = false;
this.selectionRect = null;
this.startSelectionPoint = { this.startSelectionPoint = {
x: null, x: null,
y: null, y: null,
@ -213,6 +212,10 @@ export class GroupHandlerImpl implements GroupHandler {
} }
this.statesToBeGroupped = []; this.statesToBeGroupped = [];
this.highlightedShapes = {}; this.highlightedShapes = {};
if (this.selectionRect) {
this.selectionRect.remove();
this.selectionRect = null;
}
} }
public cancel(): void { public cancel(): void {

Loading…
Cancel
Save