import{addRegisterMxDbEntity}from"../../tools/registerMxDbEntity";import MxDbShape from"../MxDbShape";import drawMxDbStarShape from"./draw";class MxDbStarShape extends MxDbShape{constructor(){super(),this.center=new THREE.Vector3,this.numPoints=10,this.innerRadius=10,this.outerRadius=10,this._propertyDbKeys=[...this._propertyDbKeys,"center","numPoints","innerRadius","outerRadius"]}getTypeName(){return"MxDbStarShape"}worldDraw(t){const{x:e,y:r}=this.center,i=new THREE.Path;i.moveTo(e,r-this.outerRadius);for(let t=1;t<2*this.numPoints;t++){const s=t%2==0?this.outerRadius:this.innerRadius,n=s*Math.sin(t*Math.PI/this.numPoints)+e,o=-1*s*Math.cos(t*Math.PI/this.numPoints)+r;i.lineTo(n,o)}i.closePath();const s=this.createPaths(i),n=this.getShapePoints(s);this._draw(t,n),this._drawStoreLine(t,n)}getGripPoints(){return[this.center]}moveGripPointsAt(t,e){return 0===t&&this.center.add(e),!0}}MxDbStarShape.cmd="Mx_MxDbStarShape",MxDbStarShape.draw=drawMxDbStarShape;export class MxDbStarShapeDraw extends MxDbStarShape{constructor(){super(),this.innerPoint=new THREE.Vector3,this.outerPoint=new THREE.Vector3,this._propertyDbKeys=[...this._propertyDbKeys,"innerPoint","outerPoint"]}getGripPoints(){return[this.center,this.innerPoint,this.outerPoint]}moveGripPointsAt(t,e){return 0===t&&(this.center.add(e),this.innerPoint.add(e),this.outerPoint.add(e)),1===t&&this.innerPoint.add(e),2===t&&this.outerPoint.add(e),!0}worldDraw(t){this.innerPoint&&(this.innerRadius=this.center.distanceTo(this.innerPoint)),this.outerPoint&&(this.outerRadius=this.center.distanceTo(this.outerPoint)),super.worldDraw(t)}};addRegisterMxDbEntity(MxDbStarShape);export default MxDbStarShape;