mirror of
https://github.com/google/blockly.git
synced 2026-01-05 08:00:09 +01:00
fix: drag strategy only clear group id set by us (#8355)
Add a condition check so that we don't unset the group ID that is not set by us. Otherwise the multi-select plugin undo/redo will be broken (apply individually instead of all together) Signed-off-by: Hollow Man <hollowman@opensuse.org>
This commit is contained in:
@@ -61,6 +61,9 @@ export class BlockDragStrategy implements IDragStrategy {
|
||||
*/
|
||||
private dragOffset = new Coordinate(0, 0);
|
||||
|
||||
/** Was there already an event group in progress when the drag started? */
|
||||
private inGroup: boolean = false;
|
||||
|
||||
constructor(private block: BlockSvg) {
|
||||
this.workspace = block.workspace;
|
||||
}
|
||||
@@ -92,7 +95,8 @@ export class BlockDragStrategy implements IDragStrategy {
|
||||
}
|
||||
|
||||
this.dragging = true;
|
||||
if (!eventUtils.getGroup()) {
|
||||
this.inGroup = !!eventUtils.getGroup();
|
||||
if (!this.inGroup) {
|
||||
eventUtils.setGroup(true);
|
||||
}
|
||||
this.fireDragStartEvent();
|
||||
@@ -389,7 +393,9 @@ export class BlockDragStrategy implements IDragStrategy {
|
||||
this.connectionPreviewer!.dispose();
|
||||
this.workspace.setResizesEnabled(true);
|
||||
|
||||
eventUtils.setGroup(false);
|
||||
if (!this.inGroup) {
|
||||
eventUtils.setGroup(false);
|
||||
}
|
||||
}
|
||||
|
||||
/** Connects the given candidate connections. */
|
||||
|
||||
@@ -13,6 +13,9 @@ import * as layers from '../layers.js';
|
||||
export class BubbleDragStrategy implements IDragStrategy {
|
||||
private startLoc: Coordinate | null = null;
|
||||
|
||||
/** Was there already an event group in progress when the drag started? */
|
||||
private inGroup: boolean = false;
|
||||
|
||||
constructor(
|
||||
private bubble: IBubble,
|
||||
private workspace: WorkspaceSvg,
|
||||
@@ -23,7 +26,8 @@ export class BubbleDragStrategy implements IDragStrategy {
|
||||
}
|
||||
|
||||
startDrag(): void {
|
||||
if (!eventUtils.getGroup()) {
|
||||
this.inGroup = !!eventUtils.getGroup();
|
||||
if (!this.inGroup) {
|
||||
eventUtils.setGroup(true);
|
||||
}
|
||||
this.startLoc = this.bubble.getRelativeToSurfaceXY();
|
||||
@@ -38,7 +42,9 @@ export class BubbleDragStrategy implements IDragStrategy {
|
||||
|
||||
endDrag(): void {
|
||||
this.workspace.setResizesEnabled(true);
|
||||
eventUtils.setGroup(false);
|
||||
if (!this.inGroup) {
|
||||
eventUtils.setGroup(false);
|
||||
}
|
||||
|
||||
this.workspace
|
||||
.getLayerManager()
|
||||
|
||||
@@ -17,6 +17,9 @@ export class CommentDragStrategy implements IDragStrategy {
|
||||
|
||||
private workspace: WorkspaceSvg;
|
||||
|
||||
/** Was there already an event group in progress when the drag started? */
|
||||
private inGroup: boolean = false;
|
||||
|
||||
constructor(private comment: RenderedWorkspaceComment) {
|
||||
this.workspace = comment.workspace;
|
||||
}
|
||||
@@ -26,7 +29,8 @@ export class CommentDragStrategy implements IDragStrategy {
|
||||
}
|
||||
|
||||
startDrag(): void {
|
||||
if (!eventUtils.getGroup()) {
|
||||
this.inGroup = !!eventUtils.getGroup();
|
||||
if (!this.inGroup) {
|
||||
eventUtils.setGroup(true);
|
||||
}
|
||||
this.fireDragStartEvent();
|
||||
@@ -52,7 +56,9 @@ export class CommentDragStrategy implements IDragStrategy {
|
||||
this.comment.snapToGrid();
|
||||
|
||||
this.workspace.setResizesEnabled(true);
|
||||
eventUtils.setGroup(false);
|
||||
if (!this.inGroup) {
|
||||
eventUtils.setGroup(false);
|
||||
}
|
||||
}
|
||||
|
||||
/** Fire a UI event at the start of a comment drag. */
|
||||
|
||||
Reference in New Issue
Block a user