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

@ -14,9 +14,6 @@ interface IContainerProps {
const GAP = 50;
export class Container extends React.Component<IContainerProps> {
componentWillUnMount() {
}
public GetProperties(): Properties {
const properties : Properties = {
...this.props.properties
@ -55,10 +52,22 @@ export class Container extends React.Component<IContainerProps> {
return depth;
}
public getAbsolutePosition(): [number, number] {
let x = Number(this.props.properties.x);
let y = Number(this.props.properties.y);
let current = this.props.parent;
while (current != null) {
x += Number(current.props.properties.x);
y += Number(current.props.properties.y);
current = current.props.parent;
}
return [x, y];
}
public render(): React.ReactNode {
const containersElements = this.props.children.map(child => child.render());
const xText = (this.props.properties.x * 2 + Number(this.props.properties.width)) / 2;
const yText = (this.props.properties.y * 2 + Number(this.props.properties.height)) / 2;
const xText = Number(this.props.properties.width) / 2;
const yText = Number(this.props.properties.height) / 2;
// g style
const defaultStyle = {