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:
Eric Nguyen 2022-08-25 13:28:32 +00:00
parent ec3fddec9d
commit 7f3f6a489a
43 changed files with 1127 additions and 453 deletions

View file

@ -1,5 +1,15 @@
import { Dispatch, SetStateAction } from 'react';
import { getCurrentHistory } from '../Components/Editor/Editor';
import { IConfiguration } from '../Interfaces/IConfiguration';
import { IEditorState } from '../Interfaces/IEditorState';
import { IHistoryState } from '../Interfaces/IHistoryState';
import { ReviveState } from '../utils/saveload';
const initEditor = (configuration: IConfiguration): void => {
// faire comme la callback de fetch
}
const getEditorState = (editorState: IEditorState): void => {
const customEvent = new CustomEvent<IEditorState>('getEditorState', { detail: editorState });
@ -13,14 +23,35 @@ const getCurrentHistoryState = (editorState: IEditorState): void => {
document.dispatchEvent(customEvent);
};
const appendNewState = (
editorState: IEditorState,
setHistory: Dispatch<SetStateAction<IHistoryState[]>>,
setHistoryCurrentStep: Dispatch<SetStateAction<number>>,
eventInitDict?: CustomEventInit
): void => {
const state: IHistoryState = JSON.parse(eventInitDict?.detail.state);
ReviveState(state);
const history = getCurrentHistory(editorState.history, editorState.historyCurrentStep);
history.push(state);
setHistory(history);
setHistoryCurrentStep(history.length - 1);
};
export interface IEditorEvent {
name: string
func: (editorState: IEditorState) => void
func: (
editorState: IEditorState,
setHistory: Dispatch<SetStateAction<IHistoryState[]>>,
setHistoryCurrentStep: Dispatch<SetStateAction<number>>,
eventInitDict?: CustomEventInit
) => void
}
const events: IEditorEvent[] = [
{ name: 'getEditorState', func: getEditorState },
{ name: 'getCurrentHistoryState', func: getCurrentHistoryState }
{ name: 'getCurrentHistoryState', func: getCurrentHistoryState },
{ name: 'appendNewState', func: appendNewState }
];
export default events;