Merged PR 212: Optimize FindChildrenById from O(n) to O(1)
Optimize FindChildrenById from O(n) to O(1): - Deprecate FindContainerByIdDFS - Container: Replace Children to string[] - Add HashMap to IHistoryState that contains all containers To access a container by id now cost O(1) without any additional cost + Implement CICD for SVGLibs
This commit is contained in:
parent
466ef2b08b
commit
c256a76e01
45 changed files with 775 additions and 450 deletions
|
@ -174,7 +174,7 @@ function AppendContainer(root: Element | Document,
|
|||
const history = GetCurrentHistory(editorState.history, editorState.historyCurrentStep);
|
||||
const currentState = history[editorState.historyCurrentStep];
|
||||
|
||||
const parent = FindContainerById(currentState.mainContainer, parentId);
|
||||
const parent = FindContainerById(currentState.containers, parentId);
|
||||
|
||||
const newHistory = AddContainerAction(
|
||||
parent?.children.length ?? 0,
|
||||
|
@ -203,7 +203,7 @@ function AppendContainerToSelectedContainer(root: Element | Document,
|
|||
const history = GetCurrentHistory(editorState.history, editorState.historyCurrentStep);
|
||||
const currentState = history[editorState.historyCurrentStep];
|
||||
|
||||
const selected = FindContainerById(currentState.mainContainer, currentState.selectedContainerId);
|
||||
const selected = FindContainerById(currentState.containers, currentState.selectedContainerId);
|
||||
|
||||
const newHistory = AddContainerToSelectedContainerAction(
|
||||
type,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue