Symbol: Apply the width/height offset

This commit is contained in:
Eric NGUYEN 2023-02-23 12:24:34 +01:00
parent 79e5f84501
commit 1e89f7803a
2 changed files with 4 additions and 6 deletions

View file

@ -3,8 +3,6 @@ import * as React from 'react';
import { DIMENSION_MARGIN, SYMBOL_MARGIN } from '../../../../utils/default'; import { DIMENSION_MARGIN, SYMBOL_MARGIN } from '../../../../utils/default';
import { type ISymbolModel } from '../../../../Interfaces/ISymbolModel'; import { type ISymbolModel } from '../../../../Interfaces/ISymbolModel';
import { Selector } from '../Selector/Selector'; import { Selector } from '../Selector/Selector';
import { TransformX, TransformY } from '../../../../utils/svg';
import { PositionReference } from '../../../../Enums/PositionReference';
interface ISelectorSymbolProps { interface ISelectorSymbolProps {
symbols: Map<string, ISymbolModel> symbols: Map<string, ISymbolModel>
@ -25,11 +23,11 @@ export function SelectorSymbol(props: ISelectorSymbolProps): JSX.Element {
const scaledWidth = props.selected.width; const scaledWidth = props.selected.width;
if (props.selected.isVertical) { if (props.selected.isVertical) {
x = -DIMENSION_MARGIN; x = -SYMBOL_MARGIN - props.selected.width;
y = props.selected.offset; y = props.selected.offset;
} else { } else {
x = props.selected.offset; x = props.selected.offset;
y = -DIMENSION_MARGIN; y = -SYMBOL_MARGIN - props.selected.height;
} }
return ( return (

View file

@ -16,11 +16,11 @@ export function Symbol(props: ISymbolProps): JSX.Element {
let x, y: number; let x, y: number;
if (props.model.isVertical) { if (props.model.isVertical) {
x = -SYMBOL_MARGIN; x = -SYMBOL_MARGIN - props.model.width;
y = props.model.offset; y = props.model.offset;
} else { } else {
x = props.model.offset; x = props.model.offset;
y = -SYMBOL_MARGIN; y = -SYMBOL_MARGIN - props.model.height;
} }
if (hasSVG) { if (hasSVG) {