WIP2
This commit is contained in:
parent
79caa5e9ab
commit
b09718d72d
3 changed files with 14 additions and 9 deletions
|
@ -1,10 +1,10 @@
|
|||
import { IConfiguration } from '../../../Interfaces/IConfiguration';
|
||||
import { IContainerModel } from '../../../Interfaces/IContainerModel';
|
||||
import { IHistoryState } from '../../../Interfaces/IHistoryState';
|
||||
import { ISymbolModel } from '../../../Interfaces/ISymbolModel';
|
||||
import { type IConfiguration } from '../../../Interfaces/IConfiguration';
|
||||
import { type IContainerModel } from '../../../Interfaces/IContainerModel';
|
||||
import { type IHistoryState } from '../../../Interfaces/IHistoryState';
|
||||
import { type ISymbolModel } from '../../../Interfaces/ISymbolModel';
|
||||
import { GetDefaultSymbolModel } from '../../../utils/default';
|
||||
import { FindContainerById } from '../../../utils/itertools';
|
||||
import { RestoreX } from '../../../utils/svg';
|
||||
import {RestoreX, RestoreY} from '../../../utils/svg';
|
||||
import { ApplyBehaviors, ApplyBehaviorsOnSiblingsChildren } from '../Behaviors/Behaviors';
|
||||
import { GetCurrentHistory, GetCurrentHistoryState, UpdateCounters } from '../Editor';
|
||||
import { AddContainers } from './AddContainer';
|
||||
|
@ -32,7 +32,12 @@ export function AddSymbol(
|
|||
const newSymbols = structuredClone(current.symbols);
|
||||
const newSymbol: ISymbolModel = GetDefaultSymbolModel(name, typeCounters, type, symbolConfig);
|
||||
const containers = structuredClone(current.containers);
|
||||
newSymbol.x = RestoreX(newSymbol.x, newSymbol.width, newSymbol.config.PositionReference);
|
||||
|
||||
if (newSymbol.isVertical) {
|
||||
newSymbol.offset = RestoreY(newSymbol.offset, newSymbol.height, newSymbol.config.PositionReference);
|
||||
} else {
|
||||
newSymbol.offset = RestoreX(newSymbol.offset, newSymbol.width, newSymbol.config.PositionReference);
|
||||
}
|
||||
|
||||
newSymbols.set(newSymbol.id, newSymbol);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { ApplyParentTransform, FindContainerById } from '../../../utils/itertool
|
|||
import { RestoreX, TransformX } from '../../../utils/svg';
|
||||
|
||||
export function ApplySymbol(containers: Map<string, IContainerModel>, container: IContainerModel, symbol: ISymbolModel): IContainerModel {
|
||||
container.properties.x = TransformX(symbol.x, symbol.width, symbol.config.PositionReference);
|
||||
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;
|
||||
|
|
|
@ -34,9 +34,9 @@ export function SymbolForm(props: ISymbolFormProps): JSX.Element {
|
|||
value={props.symbol.displayedText}
|
||||
onChange={(value) => { props.onChange('displayedText', value); }} />
|
||||
<TextInputGroup
|
||||
id='x'
|
||||
id='offset'
|
||||
labelText={Text({ textId: '@SymbolOffset' })}
|
||||
inputKey='x'
|
||||
inputKey='offset'
|
||||
labelClassName=''
|
||||
inputClassName=''
|
||||
type='number'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue