[Update] Translation and fix
This commit is contained in:
parent
174767f22c
commit
4c2cf66667
6 changed files with 49 additions and 11 deletions
|
@ -7,7 +7,7 @@ export function ApplySymbol(containers: Map<string, IContainerModel>,
|
|||
container: IContainerModel,
|
||||
symbol: ISymbolModel): IContainerModel {
|
||||
if (symbol.isVertical) {
|
||||
container.properties.y = TransformY(symbol.offset + (symbol.height / 2),
|
||||
container.properties.y = TransformY(symbol.offset,
|
||||
symbol.height,
|
||||
symbol.config.PositionReference);
|
||||
container.properties.y = RestoreY(container.properties.y,
|
||||
|
|
|
@ -167,11 +167,11 @@ function Dimensions({ containers, symbols, root, scale }: IDimensionLayerProps):
|
|||
|
||||
for (const symbol of symbols) {
|
||||
if (symbol[1].showDimension) {
|
||||
startDepthHorizontalSymbols++;
|
||||
startDepthVerticalSymbols++;
|
||||
if (symbol[1].isVertical) {
|
||||
startDepthVerticalSymbols++;
|
||||
AddVerticalSymbolDimension(symbol[1], dimensions, scale, startDepthVerticalSymbols);
|
||||
} else {
|
||||
startDepthHorizontalSymbols++;
|
||||
AddHorizontalSymbolDimension(symbol[1], dimensions, scale, startDepthHorizontalSymbols);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,11 +37,11 @@ export function Symbol(props: ISymbolProps): JSX.Element {
|
|||
);
|
||||
}
|
||||
if (props.model.isVertical) {
|
||||
x = (-SYMBOL_MARGIN - props.model.height) / props.scale;
|
||||
x = (-SYMBOL_MARGIN - props.model.width) / props.scale;
|
||||
y = (props.model.offset + props.model.height / 2) - (props.model.height / props.scale / 2);
|
||||
} else {
|
||||
x = (props.model.offset + props.model.width / 2) - (props.model.width / props.scale / 2);
|
||||
y = (-SYMBOL_MARGIN - props.model.width) / props.scale;
|
||||
y = (-SYMBOL_MARGIN - props.model.height) / props.scale;
|
||||
}
|
||||
return (
|
||||
<image
|
||||
|
|
|
@ -4,8 +4,8 @@ import { RestoreX, RestoreY, TransformX, TransformY } from '../../utils/svg';
|
|||
import { InputGroup } from '../InputGroup/InputGroup';
|
||||
import { TextInputGroup } from '../InputGroup/TextInputGroup';
|
||||
import { Text } from '../Text/Text';
|
||||
import { PropertyType } from '../../Enums/PropertyType';
|
||||
import { ToggleButton } from '../ToggleButton/ToggleButton';
|
||||
import { type PositionReference } from '../../Enums/PositionReference';
|
||||
|
||||
interface ISymbolFormProps {
|
||||
symbol: ISymbolModel
|
||||
|
@ -13,6 +13,29 @@ interface ISymbolFormProps {
|
|||
onChange: (key: string, value: string | number | boolean) => void
|
||||
}
|
||||
|
||||
function Restore(offset: number,
|
||||
isVertical: boolean,
|
||||
height: number,
|
||||
width: number,
|
||||
position: PositionReference | undefined): number {
|
||||
if (isVertical) {
|
||||
return RestoreY(offset, height, position);
|
||||
} else {
|
||||
return RestoreX(offset, width, position);
|
||||
}
|
||||
}
|
||||
function Transform(offset: number,
|
||||
isVertical: boolean,
|
||||
height: number,
|
||||
width: number,
|
||||
position: PositionReference | undefined): number {
|
||||
if (isVertical) {
|
||||
return TransformY(offset, height, position);
|
||||
} else {
|
||||
return TransformX(offset, width, position);
|
||||
}
|
||||
}
|
||||
|
||||
export function SymbolForm(props: ISymbolFormProps): JSX.Element {
|
||||
return (
|
||||
<div className='grid grid-cols-2 gap-y-4'>
|
||||
|
@ -40,10 +63,21 @@ export function SymbolForm(props: ISymbolFormProps): JSX.Element {
|
|||
labelClassName=''
|
||||
inputClassName=''
|
||||
type='number'
|
||||
value={TransformX(props.symbol.offset, props.symbol.width, props.symbol.config.PositionReference).toString()}
|
||||
onChange={(value) => { props.onChange('offset', RestoreX(Number(value), props.symbol.width, props.symbol.config.PositionReference)); }} />
|
||||
value={Transform(props.symbol.offset,
|
||||
props.symbol.isVertical,
|
||||
props.symbol.height,
|
||||
props.symbol.width,
|
||||
props.symbol.config.PositionReference).toString()}
|
||||
onChange={(value) => {
|
||||
props.onChange('offset',
|
||||
Restore(Number(value),
|
||||
props.symbol.isVertical,
|
||||
props.symbol.height,
|
||||
props.symbol.width,
|
||||
props.symbol.config.PositionReference));
|
||||
}} />
|
||||
<ToggleButton
|
||||
labelText={Text({ textId: '@isVertical' })}
|
||||
labelText={Text({ textId: '@IsVertical' })}
|
||||
inputKey='isVertical'
|
||||
labelClassName=''
|
||||
inputClassName=''
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
|
||||
"@SymbolName": "Name",
|
||||
"@SymbolDisplayedText": "Displayed text",
|
||||
"@SymbolX": "x",
|
||||
"@SymbolOffset" : "Offset",
|
||||
"@IsVertical" : "Vertical",
|
||||
"@ShowDimension" : "Dimension",
|
||||
"@SymbolHeight": "Height",
|
||||
"@SymbolWidth": "Width"
|
||||
}
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
|
||||
"@SymbolName": "Nom",
|
||||
"@SymbolDisplayedText": "Texte affiché",
|
||||
"@SymbolX": "x",
|
||||
"@SymbolOffset" : "Décalage",
|
||||
"@IsVertical" : "Vertical",
|
||||
"@ShowDimension" : "Cotation",
|
||||
"@SymbolHeight": "Hauteur",
|
||||
"@SymbolWidth": "Largeur"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue