mirror of
https://github.com/google/blockly.git
synced 2026-01-06 08:30:13 +01:00
feat: Add 'reason' field to move event (#6996)
* feat: Add 'reason' field to move event There are many types of move. This addition allows one to detect what the reason for each move is. * Clang formatting. And unsaved editor tabs. * Change reason string to array.
This commit is contained in:
@@ -433,7 +433,8 @@ export function domToWorkspace(xml: Element, workspace: Workspace): string[] {
|
||||
const blockX = parseInt(xmlChildElement.getAttribute('x') ?? '10', 10);
|
||||
const blockY = parseInt(xmlChildElement.getAttribute('y') ?? '10', 10);
|
||||
if (!isNaN(blockX) && !isNaN(blockY)) {
|
||||
block.moveBy(workspace.RTL ? width - blockX : blockX, blockY);
|
||||
block.moveBy(
|
||||
workspace.RTL ? width - blockX : blockX, blockY, ['create']);
|
||||
}
|
||||
variablesFirst = false;
|
||||
} else if (name === 'shadow') {
|
||||
@@ -516,7 +517,7 @@ export function appendDomToWorkspace(
|
||||
offsetX = workspace.RTL ? topX - newRightX : topX - newLeftX;
|
||||
for (let i = 0; i < newBlockIds.length; i++) {
|
||||
const block = workspace.getBlockById(newBlockIds[i]);
|
||||
block!.moveBy(offsetX, offsetY);
|
||||
block!.moveBy(offsetX, offsetY, ['create']);
|
||||
}
|
||||
}
|
||||
return newBlockIds;
|
||||
|
||||
Reference in New Issue
Block a user