From 2561005d19570ca0a0686d501695b1e195ebe415 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Thu, 20 Apr 2023 20:23:19 +0200 Subject: [PATCH] Clang formatting. And unsaved editor tabs. --- core/block_svg.ts | 2 -- core/events/events_block_move.ts | 16 ++++++++-------- core/events/utils.ts | 4 ++-- core/xml.ts | 4 ++-- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/core/block_svg.ts b/core/block_svg.ts index 184dd7f3c..93e4ae309 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -398,7 +398,6 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, if (this.parentBlock_) { throw Error('Block has parent'); } - reason || console.log('moveBy no reason'); const eventsEnabled = eventUtils.isEnabled(); let event: BlockMove|null = null; if (eventsEnabled) { @@ -469,7 +468,6 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg, * @param reason Why is this move happening? 'drag', 'bump', 'snap', ... */ moveTo(xy: Coordinate, reason?: string) { - reason || console.log('moveTo no reason'); const curXY = this.getRelativeToSurfaceXY(); this.moveBy(xy.x - curXY.x, xy.y - curXY.y, reason); } diff --git a/core/events/events_block_move.ts b/core/events/events_block_move.ts index 5cae4a712..db98588a8 100644 --- a/core/events/events_block_move.ts +++ b/core/events/events_block_move.ts @@ -68,14 +68,14 @@ export class BlockMove extends BlockBase { /** * An explanation of what this move is for. Known values include: - * 'drag' -- A drag operation completed. - * 'bump' -- Block got bumped away from an invalid connection. - * 'snap' -- Block got shifted to line up with the grid. - * 'inbounds' -- Block got pushed back into a non-scrolling workspace. - * 'connect' -- Block got connected to another block. - * 'disconnect' -- Block got disconnected from another block. - * 'create' -- Block created via XML. - * 'cleanup' -- Workspace aligned top-level blocks. + * 'drag' -- A drag operation completed. + * 'bump' -- Block got bumped away from an invalid connection. + * 'snap' -- Block got shifted to line up with the grid. + * 'inbounds' -- Block got pushed back into a non-scrolling workspace. + * 'connect' -- Block got connected to another block. + * 'disconnect' -- Block got disconnected from another block. + * 'create' -- Block created via XML. + * 'cleanup' -- Workspace aligned top-level blocks. * Reasons may become comma separated if move events merge ('drag,bump,snap'). */ reason?: string; diff --git a/core/events/utils.ts b/core/events/utils.ts index 975a29cbb..d588764d8 100644 --- a/core/events/utils.ts +++ b/core/events/utils.ts @@ -291,9 +291,9 @@ export function filter(queueIn: Abstract[], forward: boolean): Abstract[] { lastEvent.newInputName = moveEvent.newInputName; lastEvent.newCoordinate = moveEvent.newCoordinate; if (moveEvent.reason) { - // Contatenate reasons into a comma separated string - // without duplicates. if (lastEvent.reason) { + // Contatenate reasons into a comma separated string + // without duplicates. const reasonSet = new Set(moveEvent.reason.split(',').concat( lastEvent.reason.split(','))); lastEvent.reason = Array.from(reasonSet).join(','); diff --git a/core/xml.ts b/core/xml.ts index 1815029dc..f753de956 100644 --- a/core/xml.ts +++ b/core/xml.ts @@ -433,8 +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, 'create'); + block.moveBy( + workspace.RTL ? width - blockX : blockX, blockY, 'create'); } variablesFirst = false; } else if (name === 'shadow') {