[Update] Poc symbol Y working
This commit is contained in:
parent
b09718d72d
commit
8b33acb139
4 changed files with 109 additions and 34 deletions
|
@ -1,16 +1,28 @@
|
|||
import { IContainerModel } from '../../../Interfaces/IContainerModel';
|
||||
import { ISymbolModel } from '../../../Interfaces/ISymbolModel';
|
||||
import { type IContainerModel } from '../../../Interfaces/IContainerModel';
|
||||
import { type ISymbolModel } from '../../../Interfaces/ISymbolModel';
|
||||
import { ApplyParentTransform, FindContainerById } from '../../../utils/itertools';
|
||||
import { RestoreX, TransformX } from '../../../utils/svg';
|
||||
import { RestoreX, RestoreY, TransformX, TransformY } from '../../../utils/svg';
|
||||
|
||||
export function ApplySymbol(containers: Map<string, IContainerModel>, container: IContainerModel, symbol: ISymbolModel): IContainerModel {
|
||||
container.properties.x = TransformX(symbol.offset, symbol.width, symbol.config.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) {
|
||||
([x] = ApplyParentTransform(containers, parent, container.properties.x, 0));
|
||||
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);
|
||||
const parent = FindContainerById(containers, container.properties.parentId);
|
||||
let y = 0;
|
||||
if (parent !== undefined && parent !== null) {
|
||||
([,y] = ApplyParentTransform(containers, parent, 0, container.properties.y));
|
||||
}
|
||||
container.properties.y = y;
|
||||
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);
|
||||
const parent = FindContainerById(containers, container.properties.parentId);
|
||||
let x = 0;
|
||||
if (parent !== undefined && parent !== null) {
|
||||
([x] = ApplyParentTransform(containers, parent, container.properties.x, 0));
|
||||
}
|
||||
container.properties.x = x;
|
||||
return container;
|
||||
}
|
||||
container.properties.x = x;
|
||||
return container;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue