From b4380570a266a8e99384127602b59adc2d5a2732 Mon Sep 17 00:00:00 2001 From: Siklos Date: Thu, 18 Aug 2022 14:23:25 +0200 Subject: [PATCH 1/3] Fix dimension not having keys --- src/Components/SVG/Elements/DepthDimensionLayer.tsx | 1 + src/Components/SVG/Elements/DimensionLayer.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Components/SVG/Elements/DepthDimensionLayer.tsx b/src/Components/SVG/Elements/DepthDimensionLayer.tsx index 4dd0549..a32dbda 100644 --- a/src/Components/SVG/Elements/DepthDimensionLayer.tsx +++ b/src/Components/SVG/Elements/DepthDimensionLayer.tsx @@ -78,6 +78,7 @@ function AddNewDimension(currentDepth: number, min: number, max: number, lastY: dimensions.push( { const text = width.toString(); dimensions.push( Date: Thu, 18 Aug 2022 14:23:42 +0200 Subject: [PATCH 2/3] Add option to hide text --- src/Components/SVG/Elements/Container.tsx | 16 +++++++++------- src/utils/default.ts | 5 +++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Components/SVG/Elements/Container.tsx b/src/Components/SVG/Elements/Container.tsx index b6c42a9..ff84123 100644 --- a/src/Components/SVG/Elements/Container.tsx +++ b/src/Components/SVG/Elements/Container.tsx @@ -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, SHOW_CHILDREN_DIMENSIONS, SHOW_PARENT_DIMENSION } from '../../../utils/default'; +import { DIMENSION_MARGIN, SHOW_CHILDREN_DIMENSIONS, SHOW_PARENT_DIMENSION, SHOW_TEXT } from '../../../utils/default'; import { getDepth } from '../../../utils/itertools'; import { Dimension } from './Dimension'; import IProperties from '../../../Interfaces/IProperties'; @@ -93,12 +93,14 @@ export const Container: React.FC = (props: IContainerProps) => } { dimensionChildren } { svg } - - {props.model.properties.id} - + { SHOW_TEXT + ? + {props.model.properties.id} + + : null } { containersElements } ); diff --git a/src/utils/default.ts b/src/utils/default.ts index 348100f..ff556ec 100644 --- a/src/utils/default.ts +++ b/src/utils/default.ts @@ -4,6 +4,10 @@ import { IConfiguration } from '../Interfaces/IConfiguration'; import { IContainerModel } from '../Interfaces/IContainerModel'; import IProperties from '../Interfaces/IProperties'; +/// CONTAINRE DEFAULTS /// + +export const SHOW_TEXT = true; + /// DIMENSIONS DEFAULTS /// export const SHOW_PARENT_DIMENSION = true; @@ -14,6 +18,7 @@ export const NOTCHES_LENGTH = 4; /// EDITOR DEFAULTS /// +export const ENABLE_SHORTCUTS = true; export const MAX_HISTORY = 200; export const DEFAULT_CONFIG: IConfiguration = { From 39a47659b62f167b8a82a003abf7fd0ce52be479 Mon Sep 17 00:00:00 2001 From: Siklos Date: Thu, 18 Aug 2022 14:23:56 +0200 Subject: [PATCH 3/3] Add option to disable shortcuts --- src/Components/Editor/Shortcuts.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Components/Editor/Shortcuts.ts b/src/Components/Editor/Shortcuts.ts index aa20d96..f7d7b5b 100644 --- a/src/Components/Editor/Shortcuts.ts +++ b/src/Components/Editor/Shortcuts.ts @@ -1,5 +1,6 @@ import { Dispatch, SetStateAction } from 'react'; import { IHistoryState } from '../../Interfaces/IHistoryState'; +import { ENABLE_SHORTCUTS } from '../../utils/default'; export function onKeyDown( event: KeyboardEvent, @@ -7,6 +8,10 @@ export function onKeyDown( historyCurrentStep: number, setHistoryCurrentStep: Dispatch> ): void { + if (!ENABLE_SHORTCUTS) { + return; + } + event.preventDefault(); if (event.isComposing || event.keyCode === 229) { return;