箭头设备调整
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.beginFill(ArrowConsts.lineColor, 1);
|
||||
if (this.arrowGraphic.drawRegularPolygon) {
|
||||
this.arrowGraphic.drawRegularPolygon(
|
||||
-10,
|
||||
0,
|
||||
10,
|
||||
3,
|
||||
Math.atan2(p2.y - p1.y, p2.x - p1.y)
|
||||
);
|
||||
let roation = Math.PI / 2;
|
||||
const angle = Math.atan2(p1.y - p2.y, p1.x - p2.x);
|
||||
if (angle > Math.PI / 2) {
|
||||
roation = angle - Math.PI / 2;
|
||||
} else if (angle <= Math.PI / 2 && angle >= 0) {
|
||||
roation = Math.PI / 2 - angle;
|
||||
} else {
|
||||
roation = angle - Math.PI / 2;
|
||||
}
|
||||
this.arrowGraphic.drawRegularPolygon(p2.x, p2.y, 10, 3, roation);
|
||||
}
|
||||
this.arrowGraphic.endFill();
|
||||
}
|
||||
|
@ -70,13 +70,16 @@ export class ArrowDraw extends GraphicDrawAssistant<ArrowTemplate, IArrowData> {
|
||||
this.arrowGraphic.clear();
|
||||
this.arrowGraphic.beginFill(ArrowConsts.lineColor, 1);
|
||||
if (this.arrowGraphic.drawRegularPolygon) {
|
||||
this.arrowGraphic.drawRegularPolygon(
|
||||
-10,
|
||||
0,
|
||||
10,
|
||||
3,
|
||||
Math.atan2(p.y - p1.y, p.x - p1.y)
|
||||
);
|
||||
let roation = Math.PI / 2;
|
||||
const angle = Math.atan2(p1.y - p.y, p1.x - p.x);
|
||||
if (angle > Math.PI / 2) {
|
||||
roation = angle - Math.PI / 2;
|
||||
} else if (angle <= Math.PI / 2 && angle >= 0) {
|
||||
roation = Math.PI / 2 - angle;
|
||||
} else {
|
||||
roation = angle - Math.PI / 2;
|
||||
}
|
||||
this.arrowGraphic.drawRegularPolygon(p.x, p.y, 10, 3, roation);
|
||||
}
|
||||
this.arrowGraphic.endFill();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user