[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) {