[WIP] Height

This commit is contained in:
Carl Fuchs 2023-02-20 15:32:06 +01:00
parent 869cd2a7c4
commit 387e103501
3 changed files with 15 additions and 12 deletions

View file

@ -3,10 +3,14 @@ import { type ISymbolModel } from '../../../Interfaces/ISymbolModel';
import { ApplyParentTransform, FindContainerById } from '../../../utils/itertools';
import { RestoreX, RestoreY, TransformX, TransformY } from '../../../utils/svg';
export function ApplySymbol(containers: Map<string, IContainerModel>, container: IContainerModel, symbol: ISymbolModel): IContainerModel {
export function ApplySymbol(containers: Map<string, IContainerModel>,
container: IContainerModel,
symbol: ISymbolModel): IContainerModel {
if (symbol.isVertical) {
container.properties.y = TransformY(symbol.offset, symbol.height, symbol.config.PositionReference);
container.properties.y = RestoreY(container.properties.y, container.properties.height, container.properties.positionReference);
container.properties.y = TransformY(symbol.offset, 0, symbol.config.PositionReference);
container.properties.y = RestoreY(container.properties.y,
container.properties.height,
container.properties.positionReference);
const parent = FindContainerById(containers, container.properties.parentId);
let y = 0;
if (parent !== undefined && parent !== null) {
@ -16,7 +20,9 @@ export function ApplySymbol(containers: Map<string, IContainerModel>, container:
return container;
} else {
container.properties.x = TransformX(symbol.offset, symbol.width, symbol.config.PositionReference);
container.properties.x = RestoreX(container.properties.x, container.properties.width, container.properties.positionReference);
container.properties.x = RestoreX(container.properties.x,
container.properties.width,
container.properties.positionReference);
const parent = FindContainerById(containers, container.properties.parentId);
let x = 0;
if (parent !== undefined && parent !== null) {

View file

@ -28,16 +28,13 @@ export function SelectorSymbol(props: ISelectorSymbolProps): JSX.Element {
if (props.selected.isVertical) {
x = -SYMBOL_MARGIN;
y = props.selected.offset;
y = (props.selected.offset + props.selected.height / 2) - height;
} else {
[x,y] = [
props.selected.offset + props.selected.width / 2,
-SYMBOL_MARGIN - height]
[x, y] = [
props.selected.offset + props.selected.width / 2,
-SYMBOL_MARGIN - height];
}
const xText = x + width / 2;
const yText = y + height / 2;
const style: React.CSSProperties = {
transform: 'translateX(-50%)',
transformBox: 'fill-box'

View file

@ -38,7 +38,7 @@ export function Symbol(props: ISymbolProps): JSX.Element {
}
if (props.model.isVertical) {
x = -SYMBOL_MARGIN;
y = props.model.offset + props.model.width / 2;
y = props.model.offset + props.model.height / 2;
} else {
x = props.model.offset + props.model.width / 2;
y = -SYMBOL_MARGIN;