Skip to content

Commit

Permalink
Reset undo stack fro circuit import Updated UndoUtils.ts and modifi…
Browse files Browse the repository at this point in the history
…ed 'Workspace.ts'
  • Loading branch information
kghs-aver committed Dec 9, 2024
1 parent 0073939 commit d675da2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
16 changes: 8 additions & 8 deletions ArduinoFrontend/src/app/Libs/UndoUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ export abstract class UndoUtils {
this.loadChange(cng, 'redo');
}
}
/**
* Resets the undo and redo stacks
*/
static resetStacks() {
UndoUtils.undo = []; // Clear undo stack
UndoUtils.redo = []; // Clear redo stack
console.log('Undo and redo stacks have been reset.');
}
/**
* Resets the undo and redo stacks
*/
static resetStacks() {
UndoUtils.undo = []; // Clear undo stack
UndoUtils.redo = []; // Clear redo stack
console.log('Undo and redo stacks have been reset.');
}
/**
* Function to reset redo stack & push into undo stack
* @param ele event snapshot
Expand Down
4 changes: 1 addition & 3 deletions ArduinoFrontend/src/app/Libs/Workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,6 @@ export class Workspace {
obj.load(comp);
}
}
UndoUtils.resetStacks();

}
}
// Wait until all components are drawn
Expand All @@ -734,7 +732,7 @@ export class Workspace {
window.hideLoading();
}
}, 100);

UndoUtils.resetStacks();
}
/** This function recreates the wire object */
static LoadWires(wires: any[], retainId = false, pushUndo = false) {
Expand Down

0 comments on commit d675da2

Please sign in to comment.