Merged PR 199: Add more Position for the dimensions + rename isDimensionBorrower and MarkPosition... + Refactor components in ContainerForm with Checkboxes and Selector + Add more docs

Add more Position for the dimensions

Rename isDimensionBorrower and MarkPosition...

Refactor components in ContainerForm with Checkboxes and Selector

Add more docs
This commit is contained in:
Eric Nguyen 2022-09-30 09:28:08 +00:00
parent 38666af314
commit b88539e34d
13 changed files with 494 additions and 314 deletions

View file

@ -7,38 +7,40 @@ import { IContainerProperties } from '../Interfaces/IContainerProperties';
import { IEditorState } from '../Interfaces/IEditorState';
import { ISymbolModel } from '../Interfaces/ISymbolModel';
import { Orientation } from '../Enums/Orientation';
import { Position } from '../Enums/Position';
/// EDITOR DEFAULTS ///
/** Enable fast boot and disable main menu */
/** Enable fast boot and disable main menu (default = false) */
export const FAST_BOOT = false;
/** Disable any call to the API */
/** Disable any call to the API (default = false) */
export const DISABLE_API = false;
/** Enable keyboard shortcuts */
/** Enable keyboard shortcuts (default = true) */
export const ENABLE_SHORTCUTS = true;
/** Size of the history */
/** Size of the history (recommanded = 200) */
export const MAX_HISTORY = 200;
/** Apply beheviors on children */
/** Apply beheviors on children (recommanded = true) */
export const APPLY_BEHAVIORS_ON_CHILDREN = true;
/** Framerate of the svg controller */
/** Framerate of the svg controller (recommanded = 60) */
export const MAX_FRAMERATE = 60;
/// CONTAINER DEFAULTS ///
/** Enable the swap behavior */
/** Enable the swap behavior (kinda broken recommanded = false) */
export const ENABLE_SWAP = false;
/** Enable the rigid behavior */
/** Enable the rigid behavior (recommanded = true) */
export const ENABLE_RIGID = true;
/**
* Enable the hard rigid behavior
* disallowing the container to overlap (ENABLE_RIGID must be true)
* (recommanded = false)
*/
export const ENABLE_HARD_RIGID = false;
@ -188,10 +190,10 @@ export const DEFAULT_MAINCONTAINER_PROPS: IContainerProperties = {
isFlex: false,
positionReference: PositionReference.TopLeft,
hideChildrenInTreeview: false,
showChildrenDimensions: true, // TODO: put the dimension at the top (see pdf)
showSelfDimensions: true, // TODO: put the dimension at the bottom (see pdf)
isDimensionBorrower: true, // second dimensions from the bottom
markPositionToDimensionBorrower: [],
showChildrenDimensions: [Position.Up, Position.Left],
showSelfDimensions: [Position.Up, Position.Left],
showDimensionWithMarks: [Position.Down, Position.Right],
markPosition: [],
warning: '',
style: {
stroke: 'black',
@ -240,10 +242,10 @@ export function GetDefaultContainerProps(type: string,
minHeight: containerConfig.MinWidth ?? 1,
maxHeight: containerConfig.MaxWidth ?? Number.MAX_SAFE_INTEGER,
hideChildrenInTreeview: containerConfig.HideChildrenInTreeview ?? false,
showChildrenDimensions: containerConfig.ShowChildrenDimensions ?? false,
showSelfDimensions: containerConfig.ShowSelfDimensions ?? false,
markPositionToDimensionBorrower: containerConfig.MarkPositionToDimensionBorrower ?? [],
isDimensionBorrower: containerConfig.IsDimensionBorrower ?? false,
showChildrenDimensions: containerConfig.ShowChildrenDimensions ?? [],
showSelfDimensions: containerConfig.ShowSelfDimensions ?? [],
markPosition: containerConfig.MarkPosition ?? [],
showDimensionWithMarks: containerConfig.ShowDimensionWithMarks ?? [],
warning: '',
customSVG: containerConfig.CustomSVG,
style: structuredClone(containerConfig.Style),