Merged PR 167: Add Flex and fix bugs (read desc)
Note: The branch name does not fit the new features. - Implement Flex with simplex - Enable rigid body by default (removed IsRigidBody property) <=== possibly a bad idea - Sort children in add and update properties - Implement MaxWidth - Add more docs Fixes : - .env.production url - Symbols: not blocking the linked container when the parent is moving
This commit is contained in:
parent
ec3fddec9d
commit
7f3f6a489a
43 changed files with 1127 additions and 453 deletions
|
@ -1,5 +1,6 @@
|
|||
import { findContainerById, MakeIterator } from './itertools';
|
||||
import { IEditorState } from '../Interfaces/IEditorState';
|
||||
import { IHistoryState } from '../Interfaces/IHistoryState';
|
||||
|
||||
/**
|
||||
* Revive the Editor state
|
||||
|
@ -14,31 +15,37 @@ export function Revive(editorState: IEditorState): void {
|
|||
|
||||
// restore the parents and the selected container
|
||||
for (const state of history) {
|
||||
if (state.MainContainer === null || state.MainContainer === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
state.Symbols = new Map(state.Symbols);
|
||||
for (const symbol of state.Symbols.values()) {
|
||||
symbol.linkedContainers = new Set(symbol.linkedContainers);
|
||||
}
|
||||
|
||||
const it = MakeIterator(state.MainContainer);
|
||||
for (const container of it) {
|
||||
const parentId = container.properties.parentId;
|
||||
if (parentId === null) {
|
||||
container.parent = null;
|
||||
continue;
|
||||
}
|
||||
const parent = findContainerById(state.MainContainer, parentId);
|
||||
if (parent === undefined) {
|
||||
continue;
|
||||
}
|
||||
container.parent = parent;
|
||||
}
|
||||
ReviveState(state);
|
||||
}
|
||||
}
|
||||
|
||||
export const ReviveState = (
|
||||
state: IHistoryState
|
||||
): void => {
|
||||
if (state.MainContainer === null || state.MainContainer === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
state.Symbols = new Map(state.Symbols);
|
||||
for (const symbol of state.Symbols.values()) {
|
||||
symbol.linkedContainers = new Set(symbol.linkedContainers);
|
||||
}
|
||||
|
||||
const it = MakeIterator(state.MainContainer);
|
||||
for (const container of it) {
|
||||
const parentId = container.properties.parentId;
|
||||
if (parentId === null) {
|
||||
container.parent = null;
|
||||
continue;
|
||||
}
|
||||
const parent = findContainerById(state.MainContainer, parentId);
|
||||
if (parent === undefined) {
|
||||
continue;
|
||||
}
|
||||
container.parent = parent;
|
||||
}
|
||||
};
|
||||
|
||||
export const getCircularReplacer = (): (key: any, value: object | Map<string, any> | null) => object | null | undefined => {
|
||||
return (key: any, value: object | null) => {
|
||||
if (key === 'parent') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue