Added new defaults settings

This commit is contained in:
Siklos 2022-08-18 13:05:47 +02:00
parent 70863261aa
commit d854218c9d
2 changed files with 25 additions and 16 deletions

View file

@ -2,7 +2,7 @@ import * as React from 'react';
import { Interweave, Node } from 'interweave';
import { XPositionReference } from '../../../Enums/XPositionReference';
import { IContainerModel } from '../../../Interfaces/IContainerModel';
import { DIMENSION_MARGIN } from '../../../utils/default';
import { DIMENSION_MARGIN, SHOW_CHILDREN_DIMENSIONS, SHOW_PARENT_DIMENSION } from '../../../utils/default';
import { getDepth } from '../../../utils/itertools';
import { Dimension } from './Dimension';
import IProperties from '../../../Interfaces/IProperties';
@ -54,7 +54,7 @@ export const Container: React.FC<IContainerProps> = (props: IContainerProps) =>
const text = (props.model.properties.width ?? 0).toString();
let dimensionChildren: JSX.Element | null = null;
if (props.model.children.length > 1) {
if (props.model.children.length > 1 && SHOW_CHILDREN_DIMENSIONS) {
const {
childrenId,
xChildrenStart,
@ -79,15 +79,18 @@ export const Container: React.FC<IContainerProps> = (props: IContainerProps) =>
transform={transform}
key={`container-${props.model.properties.id}`}
>
<Dimension
id={id}
xStart={xStart}
xEnd={xEnd}
yStart={y}
yEnd={y}
strokeWidth={strokeWidth}
text={text}
/>
{ SHOW_PARENT_DIMENSION
? <Dimension
id={id}
xStart={xStart}
xEnd={xEnd}
yStart={y}
yEnd={y}
strokeWidth={strokeWidth}
text={text}
/>
: null
}
{ dimensionChildren }
{ svg }
<text

View file

@ -4,6 +4,17 @@ import { IConfiguration } from '../Interfaces/IConfiguration';
import { IContainerModel } from '../Interfaces/IContainerModel';
import IProperties from '../Interfaces/IProperties';
/// DIMENSIONS DEFAULTS ///
export const SHOW_PARENT_DIMENSION = true;
export const SHOW_CHILDREN_DIMENSIONS = true;
export const DIMENSION_MARGIN = 50;
export const NOTCHES_LENGTH = 4;
/// EDITOR DEFAULTS ///
export const MAX_HISTORY = 200;
export const DEFAULT_CONFIG: IConfiguration = {
AvailableContainers: [
{
@ -67,8 +78,3 @@ export const GetDefaultContainerProps = (
style: containerConfig.Style,
userData: containerConfig.UserData
});
export const DIMENSION_MARGIN = 50;
export const NOTCHES_LENGTH = 4;
export const MAX_HISTORY = 200;