提交 fcea8f8d 编写于 作者: B Boris Sekachev

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

上级 6f3c0cb4
......@@ -35,11 +35,11 @@ export class GroupHandlerImpl implements GroupHandler {
private getSelectionBox(
event: MouseEvent,
): {
xtl: number;
ytl: number;
xbr: number;
ybr: number;
} {
xtl: number;
ytl: number;
xbr: number;
ybr: number;
} {
const point = translateToSVG((this.canvas.node as any) as SVGSVGElement, [event.clientX, event.clientY]);
const stopSelectionPoint = {
x: point[0],
......@@ -96,11 +96,11 @@ export class GroupHandlerImpl implements GroupHandler {
const bbox = shape.bbox();
const clientID = shape.attr('clientID');
if (
bbox.x > box.xtl &&
bbox.y > box.ytl &&
bbox.x + bbox.width < box.xbr &&
bbox.y + bbox.height < box.ybr &&
!(clientID in this.highlightedShapes)
bbox.x > box.xtl
&& bbox.y > box.ytl
&& bbox.x + bbox.width < box.xbr
&& bbox.y + bbox.height < box.ybr
&& !(clientID in this.highlightedShapes)
) {
const objectState = this.getStates().filter(
(state: any): boolean => state.clientID === clientID,
......@@ -124,7 +124,6 @@ export class GroupHandlerImpl implements GroupHandler {
this.resetSelectedObjects();
this.initialized = false;
this.selectionRect = null;
this.startSelectionPoint = {
x: null,
y: null,
......@@ -213,6 +212,10 @@ export class GroupHandlerImpl implements GroupHandler {
}
this.statesToBeGroupped = [];
this.highlightedShapes = {};
if (this.selectionRect) {
this.selectionRect.remove();
this.selectionRect = null;
}
}
public cancel(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册