[Fix] SymbolDimension (Canvas/Svg) => DEFAULT_DIMENSION_SYMBOL_STYLE in default.ts
This commit is contained in:
parent
6b6175a521
commit
869cd2a7c4
3 changed files with 11 additions and 14 deletions
|
@ -7,11 +7,10 @@ import {
|
||||||
SHOW_BORROWER_DIMENSIONS,
|
SHOW_BORROWER_DIMENSIONS,
|
||||||
SHOW_CHILDREN_DIMENSIONS,
|
SHOW_CHILDREN_DIMENSIONS,
|
||||||
DIMENSION_MARGIN,
|
DIMENSION_MARGIN,
|
||||||
SHOW_SELF_MARGINS_DIMENSIONS
|
SHOW_SELF_MARGINS_DIMENSIONS, DEFAULT_DIMENSION_SYMBOL_STYLE
|
||||||
} from '../../utils/default';
|
} from '../../utils/default';
|
||||||
import { FindContainerById, MakeRecursionDFSIterator, Pairwise } from '../../utils/itertools';
|
import { FindContainerById, MakeRecursionDFSIterator, Pairwise } from '../../utils/itertools';
|
||||||
import { TransformX, TransformY } from '../../utils/svg';
|
import { TransformX, TransformY } from '../../utils/svg';
|
||||||
import { type IDimensionStyle } from '../SVG/Elements/Dimension';
|
|
||||||
import { RenderDimension } from './Dimension';
|
import { RenderDimension } from './Dimension';
|
||||||
|
|
||||||
export function AddContainerDimensions(
|
export function AddContainerDimensions(
|
||||||
|
@ -589,11 +588,6 @@ function AddHorizontalSymbolDimension(
|
||||||
.toFixed(0)
|
.toFixed(0)
|
||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
// TODO: Put this in default.ts
|
|
||||||
const defaultDimensionSymbolStyle: IDimensionStyle = {
|
|
||||||
color: 'black'
|
|
||||||
};
|
|
||||||
|
|
||||||
RenderDimension(ctx, {
|
RenderDimension(ctx, {
|
||||||
id,
|
id,
|
||||||
xStart: 0,
|
xStart: 0,
|
||||||
|
@ -602,6 +596,6 @@ function AddHorizontalSymbolDimension(
|
||||||
yEnd: -offset,
|
yEnd: -offset,
|
||||||
text,
|
text,
|
||||||
scale,
|
scale,
|
||||||
style: defaultDimensionSymbolStyle
|
style: DEFAULT_DIMENSION_SYMBOL_STYLE
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import * as React from 'react';
|
||||||
import { Orientation } from '../../../Enums/Orientation';
|
import { Orientation } from '../../../Enums/Orientation';
|
||||||
import { Position } from '../../../Enums/Position';
|
import { Position } from '../../../Enums/Position';
|
||||||
import {
|
import {
|
||||||
|
DEFAULT_DIMENSION_SYMBOL_STYLE,
|
||||||
DIMENSION_MARGIN,
|
DIMENSION_MARGIN,
|
||||||
SHOW_BORROWER_DIMENSIONS,
|
SHOW_BORROWER_DIMENSIONS,
|
||||||
SHOW_CHILDREN_DIMENSIONS,
|
SHOW_CHILDREN_DIMENSIONS,
|
||||||
|
@ -10,7 +11,7 @@ import {
|
||||||
} from '../../../utils/default';
|
} from '../../../utils/default';
|
||||||
import { FindContainerById, MakeRecursionDFSIterator, Pairwise } from '../../../utils/itertools';
|
import { FindContainerById, MakeRecursionDFSIterator, Pairwise } from '../../../utils/itertools';
|
||||||
import { TransformX, TransformY } from '../../../utils/svg';
|
import { TransformX, TransformY } from '../../../utils/svg';
|
||||||
import { Dimension, type IDimensionStyle } from './Dimension';
|
import { Dimension } from './Dimension';
|
||||||
import { type IContainerModel } from '../../../Interfaces/IContainerModel';
|
import { type IContainerModel } from '../../../Interfaces/IContainerModel';
|
||||||
import { type ISymbolModel } from '../../../Interfaces/ISymbolModel';
|
import { type ISymbolModel } from '../../../Interfaces/ISymbolModel';
|
||||||
|
|
||||||
|
@ -182,7 +183,6 @@ function AddHorizontalSymbolDimension(symbol: ISymbolModel,
|
||||||
const width = symbol.offset + (symbol.width / 2);
|
const width = symbol.offset + (symbol.width / 2);
|
||||||
if (width != null && width > 0) {
|
if (width != null && width > 0) {
|
||||||
const id = `dim-y-margin-left${symbol.width.toFixed(0)}-${symbol.id}`;
|
const id = `dim-y-margin-left${symbol.width.toFixed(0)}-${symbol.id}`;
|
||||||
const style = symbol.linkedContainers.values().next().value.dimensionOptions;
|
|
||||||
|
|
||||||
const offset = (DIMENSION_MARGIN * (depth + 1)) / scale;
|
const offset = (DIMENSION_MARGIN * (depth + 1)) / scale;
|
||||||
const text = width
|
const text = width
|
||||||
|
@ -198,7 +198,7 @@ function AddHorizontalSymbolDimension(symbol: ISymbolModel,
|
||||||
yEnd={-offset}
|
yEnd={-offset}
|
||||||
text={text}
|
text={text}
|
||||||
scale={scale}
|
scale={scale}
|
||||||
style={style}/>
|
style={DEFAULT_DIMENSION_SYMBOL_STYLE}/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,6 @@ function AddVerticalSymbolDimension(symbol: ISymbolModel,
|
||||||
const height = symbol.offset + (symbol.height / 2);
|
const height = symbol.offset + (symbol.height / 2);
|
||||||
if (height != null && height > 0) {
|
if (height != null && height > 0) {
|
||||||
const id = `dim-x-margin-left${symbol.height.toFixed(0)}-${symbol.id}`;
|
const id = `dim-x-margin-left${symbol.height.toFixed(0)}-${symbol.id}`;
|
||||||
const style = symbol.linkedContainers.values().next().value.dimensionOptions;
|
|
||||||
|
|
||||||
const offset = (DIMENSION_MARGIN * (depth + 1)) / scale;
|
const offset = (DIMENSION_MARGIN * (depth + 1)) / scale;
|
||||||
const text = height
|
const text = height
|
||||||
|
@ -228,7 +227,7 @@ function AddVerticalSymbolDimension(symbol: ISymbolModel,
|
||||||
yEnd={0}
|
yEnd={0}
|
||||||
text={text}
|
text={text}
|
||||||
scale={scale}
|
scale={scale}
|
||||||
style={style}/>
|
style={DEFAULT_DIMENSION_SYMBOL_STYLE}/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { type ISymbolModel } from '../Interfaces/ISymbolModel';
|
||||||
import { Orientation } from '../Enums/Orientation';
|
import { Orientation } from '../Enums/Orientation';
|
||||||
import { AppState } from '../Enums/AppState';
|
import { AppState } from '../Enums/AppState';
|
||||||
import { type IDimensionOptions } from '../Interfaces/IDimensionOptions';
|
import { type IDimensionOptions } from '../Interfaces/IDimensionOptions';
|
||||||
|
import { type IDimensionStyle } from '../Components/SVG/Elements/Dimension';
|
||||||
|
|
||||||
/// EDITOR DEFAULTS ///
|
/// EDITOR DEFAULTS ///
|
||||||
|
|
||||||
|
@ -69,6 +70,9 @@ export const SHOW_BORROWER_DIMENSIONS = true;
|
||||||
export const DIMENSION_MARGIN = 50;
|
export const DIMENSION_MARGIN = 50;
|
||||||
export const SYMBOL_MARGIN = 25;
|
export const SYMBOL_MARGIN = 25;
|
||||||
export const NOTCHES_LENGTH = 10;
|
export const NOTCHES_LENGTH = 10;
|
||||||
|
export const DEFAULT_DIMENSION_SYMBOL_STYLE: IDimensionStyle = {
|
||||||
|
color: '#000000'
|
||||||
|
};
|
||||||
|
|
||||||
/// SYMBOL DEFAULTS ///
|
/// SYMBOL DEFAULTS ///
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue