anchorSvgPoint.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import * as React from "react";
  2. import { Vector2 } from 'babylonjs/Maths/math.vector';
  3. interface IAnchorSvgPointProps {
  4. control: Vector2;
  5. anchor: Vector2;
  6. active: boolean;
  7. type: string;
  8. index: string;
  9. selected: boolean;
  10. }
  11. export class AnchorSvgPoint extends React.Component<IAnchorSvgPointProps>{
  12. constructor(props: IAnchorSvgPointProps) {
  13. super(props);
  14. }
  15. render() {
  16. return (
  17. <>
  18. <svg x={this.props.control.x} y={this.props.control.y} style={{overflow:'visible'}}>
  19. <circle type={this.props.type} data-id={this.props.index} className={`draggable control-point ${this.props.active ? 'active' : ''}`} cx="0" cy="0" r="2" stroke="none" strokeWidth="0" fill={this.props.active ? "blue" : "black"} />
  20. </svg>
  21. <line className={`control-point ${this.props.active ? 'active' : ''}`} x1={this.props.anchor.x} y1={this.props.anchor.y} x2={this.props.control.x} y2={this.props.control.y} stroke="green" strokeWidth="0.75" />
  22. </>
  23. )
  24. }
  25. }