svg-layout-designer-react/src/Components/Editor/Behaviors/SymbolBehaviors.ts
Eric Nguyen ad126c6c28 Merged PR 170: Add new eslint rules
- naming-convention
- prefer-arrow-callback
- func-style
- import/no-default-export
2022-08-26 16:13:21 +00:00

12 lines
718 B
TypeScript

import { IContainerModel } from '../../../Interfaces/IContainerModel';
import { ISymbolModel } from '../../../Interfaces/ISymbolModel';
import { ApplyParentTransform } from '../../../utils/itertools';
import { RestoreX, TransformX } from '../../../utils/svg';
export function ApplySymbol(container: IContainerModel, symbol: ISymbolModel): IContainerModel {
container.properties.x = TransformX(symbol.x, symbol.width, symbol.config.XPositionReference);
container.properties.x = RestoreX(container.properties.x, container.properties.width, container.properties.xPositionReference);
const [x] = ApplyParentTransform(container.parent, container.properties.x, 0);
container.properties.x = x;
return container;
}