箭头设备调整
This commit is contained in:
parent
77b69005b6
commit
af08d1ae10
@ -45,13 +45,16 @@ export class Arrow extends JlGraphic implements ILineGraphic {
|
|||||||
this.arrowGraphic.clear();
|
this.arrowGraphic.clear();
|
||||||
this.arrowGraphic.beginFill(ArrowConsts.lineColor, 1);
|
this.arrowGraphic.beginFill(ArrowConsts.lineColor, 1);
|
||||||
if (this.arrowGraphic.drawRegularPolygon) {
|
if (this.arrowGraphic.drawRegularPolygon) {
|
||||||
this.arrowGraphic.drawRegularPolygon(
|
let roation = Math.PI / 2;
|
||||||
-10,
|
const angle = Math.atan2(p1.y - p2.y, p1.x - p2.x);
|
||||||
0,
|
if (angle > Math.PI / 2) {
|
||||||
10,
|
roation = angle - Math.PI / 2;
|
||||||
3,
|
} else if (angle <= Math.PI / 2 && angle >= 0) {
|
||||||
Math.atan2(p2.y - p1.y, p2.x - p1.y)
|
roation = Math.PI / 2 - angle;
|
||||||
);
|
} else {
|
||||||
|
roation = angle - Math.PI / 2;
|
||||||
|
}
|
||||||
|
this.arrowGraphic.drawRegularPolygon(p2.x, p2.y, 10, 3, roation);
|
||||||
}
|
}
|
||||||
this.arrowGraphic.endFill();
|
this.arrowGraphic.endFill();
|
||||||
}
|
}
|
||||||
|
@ -70,13 +70,16 @@ export class ArrowDraw extends GraphicDrawAssistant<ArrowTemplate, IArrowData> {
|
|||||||
this.arrowGraphic.clear();
|
this.arrowGraphic.clear();
|
||||||
this.arrowGraphic.beginFill(ArrowConsts.lineColor, 1);
|
this.arrowGraphic.beginFill(ArrowConsts.lineColor, 1);
|
||||||
if (this.arrowGraphic.drawRegularPolygon) {
|
if (this.arrowGraphic.drawRegularPolygon) {
|
||||||
this.arrowGraphic.drawRegularPolygon(
|
let roation = Math.PI / 2;
|
||||||
-10,
|
const angle = Math.atan2(p1.y - p.y, p1.x - p.x);
|
||||||
0,
|
if (angle > Math.PI / 2) {
|
||||||
10,
|
roation = angle - Math.PI / 2;
|
||||||
3,
|
} else if (angle <= Math.PI / 2 && angle >= 0) {
|
||||||
Math.atan2(p.y - p1.y, p.x - p1.y)
|
roation = Math.PI / 2 - angle;
|
||||||
);
|
} else {
|
||||||
|
roation = angle - Math.PI / 2;
|
||||||
|
}
|
||||||
|
this.arrowGraphic.drawRegularPolygon(p.x, p.y, 10, 3, roation);
|
||||||
}
|
}
|
||||||
this.arrowGraphic.endFill();
|
this.arrowGraphic.endFill();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user