XPositionReference: Fix Selector and Append
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
522cd722c0
commit
4fbc67835c
3 changed files with 31 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
import * as React from 'react';
|
||||
import { IContainerModel } from '../../../Interfaces/IContainerModel';
|
||||
import { getAbsolutePosition } from '../../../utils/itertools';
|
||||
import { transformPosition } from './Container';
|
||||
|
||||
interface ISelectorProps {
|
||||
selected: IContainerModel | null
|
||||
|
@ -15,6 +16,12 @@ export const Selector: React.FC<ISelectorProps> = (props) => {
|
|||
}
|
||||
|
||||
const [x, y] = getAbsolutePosition(props.selected);
|
||||
const [transformedX, transformedY] = transformPosition(
|
||||
x,
|
||||
y,
|
||||
Number(props.selected.properties.width),
|
||||
props.selected.properties.XPositionReference
|
||||
);
|
||||
const [width, height] = [
|
||||
props.selected.properties.width,
|
||||
props.selected.properties.height
|
||||
|
@ -31,8 +38,8 @@ export const Selector: React.FC<ISelectorProps> = (props) => {
|
|||
|
||||
return (
|
||||
<rect
|
||||
x={x}
|
||||
y={y}
|
||||
x={transformedX}
|
||||
y={transformedY}
|
||||
width={width}
|
||||
height={height}
|
||||
style={style}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue