Implement basic selector + fix text position
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Siklos 2022-08-03 23:59:53 +02:00
parent 42cd768cf4
commit 7236fc85bf
4 changed files with 59 additions and 7 deletions

View file

@ -0,0 +1,41 @@
import * as React from 'react';
import { Container } from './Container';
interface ISelectorProps {
selected: Container | null
}
export const Selector: React.FC<ISelectorProps> = (props) => {
if (props.selected === undefined || props.selected === null) {
return (
<rect visibility={'hidden'}>
</rect>
);
}
const [x, y] = props.selected.getAbsolutePosition();
const [width, height] = [
props.selected.props.properties.width,
props.selected.props.properties.height
];
const style = {
strokeDasharray: '8, 10',
stroke: '#3B82F6', // tw blue-500
strokeWidth: 4,
fillOpacity: 0,
transitionProperty: 'all',
transitionTimingFunction: 'cubic-bezier(0.4, 0, 0.2, 1)',
transitionDuration: '150ms'
} as React.CSSProperties;
return (
<rect
x={x}
y={y}
width={width}
height={height}
style={style}
>
</rect>
);
};