From ce14c7a714e854c76cbb3bf9b36db332a4dc5810 Mon Sep 17 00:00:00 2001 From: AdrySky Date: Wed, 20 Jul 2022 11:07:42 +0800 Subject: [PATCH 1/2] Initialize last node's position --- src/components/state/MoveItemsState.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/state/MoveItemsState.ts b/src/components/state/MoveItemsState.ts index ee1095c9..07c07c69 100644 --- a/src/components/state/MoveItemsState.ts +++ b/src/components/state/MoveItemsState.ts @@ -54,6 +54,7 @@ export class MoveItemsState extends Abstr element.setSelected(true); this.engine.repaintCanvas(); this.initialPosition = element['position']; + this.finalPosition = element['position']; } }) ); @@ -62,12 +63,10 @@ export class MoveItemsState extends Abstr new Action({ type: InputType.MOUSE_UP, fire: () => { - // When node's position is empty, just return - if (this.initialPosition == null || this.finalPosition == null) return; // When node in the same position, just return if ( - this.initialPosition.x === this.finalPosition.x && - this.initialPosition.y === this.finalPosition.y + this.initialPosition?.x === this.finalPosition?.x && + this.initialPosition?.y === this.finalPosition?.y ) { return; } From 85eb5c54627f9f3de06dc82815e6bd18f72e2b8f Mon Sep 17 00:00:00 2001 From: AdrySky Date: Wed, 20 Jul 2022 11:08:37 +0800 Subject: [PATCH 2/2] Add default for edit literal --- src/commands/NodeActionCommands.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/commands/NodeActionCommands.tsx b/src/commands/NodeActionCommands.tsx index 8f70e081..0d16a839 100644 --- a/src/commands/NodeActionCommands.tsx +++ b/src/commands/NodeActionCommands.tsx @@ -550,6 +550,8 @@ export function addNodeActionCommands( case "True": case "False": return; + default: + break; } const newTitle = `Update ${literalType}`; const dialogOptions = inputDialog(newTitle, oldValue, literalType, isStoreDataType, isTextareaInput);