|
@@ -674,36 +674,33 @@ export class SPainter extends SObject {
|
|
|
* */
|
|
|
private drawBasicArrow(line: SLine, isEnd: boolean = true): void {
|
|
|
|
|
|
- const d = 5;
|
|
|
+ const d = this.toPx(10);
|
|
|
|
|
|
const x1 = d * Math.cos(Math.PI / 4);
|
|
|
|
|
|
const y1 = d * Math.sin(Math.PI / 4);
|
|
|
|
|
|
const fo = Math.atan(line.dy / line.dx);
|
|
|
- const ang = line.dx >= 0 ? fo : fo + Math.PI;
|
|
|
+ this.save();
|
|
|
|
|
|
if (isEnd) {
|
|
|
- this.save();
|
|
|
this.translate(line.x2, line.y2);
|
|
|
- this.rotate(ang);
|
|
|
+ this.rotate((fo * 180) / Math.PI);
|
|
|
this.engine.drawPolyline([
|
|
|
new SPoint(-x1, y1),
|
|
|
new SPoint(0, 0),
|
|
|
new SPoint(-x1, -y1)
|
|
|
]);
|
|
|
- this.restore();
|
|
|
} else {
|
|
|
- this.save();
|
|
|
this.translate(line.x1, line.y1);
|
|
|
- this.rotate(ang);
|
|
|
+ this.rotate((fo * 180) / Math.PI);
|
|
|
this.engine.drawPolyline([
|
|
|
new SPoint(x1, y1),
|
|
|
new SPoint(0, 0),
|
|
|
new SPoint(x1, -y1)
|
|
|
]);
|
|
|
- this.restore();
|
|
|
}
|
|
|
+ this.restore();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -714,36 +711,33 @@ export class SPainter extends SObject {
|
|
|
* */
|
|
|
private drawTriangleArrow(line: SLine, isEnd: boolean = true): void {
|
|
|
|
|
|
- const d = 5;
|
|
|
+ const d = this.toPx(10);
|
|
|
|
|
|
const x1 = d * Math.cos(Math.PI / 12);
|
|
|
|
|
|
const y1 = d * Math.sin(Math.PI / 12);
|
|
|
|
|
|
const fo = Math.atan(line.dy / line.dx);
|
|
|
- const ang = line.dx >= 0 ? fo : fo + Math.PI;
|
|
|
+ this.save();
|
|
|
|
|
|
if (isEnd) {
|
|
|
- this.save();
|
|
|
this.translate(line.x2, line.y2);
|
|
|
- this.rotate(ang);
|
|
|
+ this.rotate((fo * 180) / Math.PI);
|
|
|
this.engine.drawPolygon([
|
|
|
new SPoint(-x1, y1),
|
|
|
new SPoint(0, 0),
|
|
|
new SPoint(-x1, -y1)
|
|
|
]);
|
|
|
- this.restore();
|
|
|
} else {
|
|
|
- this.save();
|
|
|
this.translate(line.x1, line.y1);
|
|
|
- this.rotate(ang);
|
|
|
+ this.rotate((fo * 180) / Math.PI);
|
|
|
this.engine.drawPolygon([
|
|
|
new SPoint(x1, y1),
|
|
|
new SPoint(0, 0),
|
|
|
new SPoint(x1, -y1)
|
|
|
]);
|
|
|
- this.restore();
|
|
|
}
|
|
|
+ this.restore();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -754,38 +748,35 @@ export class SPainter extends SObject {
|
|
|
* */
|
|
|
private drawDiamondArrow(line: SLine, isEnd: boolean = true): void {
|
|
|
|
|
|
- const d = 2;
|
|
|
+ const d = this.toPx(5);
|
|
|
|
|
|
const x1 = d * Math.cos(Math.PI / 4);
|
|
|
|
|
|
const y1 = d * Math.sin(Math.PI / 4);
|
|
|
|
|
|
const fo = Math.atan(line.dy / line.dx);
|
|
|
- const ang = line.dx >= 0 ? fo : fo + Math.PI;
|
|
|
+ this.save();
|
|
|
|
|
|
if (isEnd) {
|
|
|
- this.save();
|
|
|
this.translate(line.x2, line.y2);
|
|
|
- this.rotate(ang);
|
|
|
+ this.rotate((fo * 180) / Math.PI);
|
|
|
this.engine.drawPolygon([
|
|
|
new SPoint(-x1, y1),
|
|
|
new SPoint(0, 0),
|
|
|
new SPoint(-x1, -y1),
|
|
|
new SPoint(-Math.sqrt(2) * d, 0)
|
|
|
]);
|
|
|
- this.restore();
|
|
|
} else {
|
|
|
- this.save();
|
|
|
this.translate(line.x1, line.y1);
|
|
|
- this.rotate(ang);
|
|
|
+ this.rotate((fo * 180) / Math.PI);
|
|
|
this.engine.drawPolygon([
|
|
|
new SPoint(x1, y1),
|
|
|
new SPoint(0, 0),
|
|
|
new SPoint(x1, -y1),
|
|
|
new SPoint(Math.sqrt(2) * d, 0)
|
|
|
]);
|
|
|
- this.restore();
|
|
|
}
|
|
|
+ this.restore();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -796,34 +787,31 @@ export class SPainter extends SObject {
|
|
|
* */
|
|
|
private drawSquareArrow(line: SLine, isEnd: boolean = true): void {
|
|
|
|
|
|
- const d = 2;
|
|
|
+ const d = this.toPx(5);
|
|
|
|
|
|
const fo = Math.atan(line.dy / line.dx);
|
|
|
- const ang = line.dx >= 0 ? fo : fo + Math.PI;
|
|
|
+ this.save();
|
|
|
|
|
|
if (isEnd) {
|
|
|
- this.save();
|
|
|
this.translate(line.x2, line.y2);
|
|
|
- this.rotate(ang);
|
|
|
+ this.rotate((fo * 180) / Math.PI);
|
|
|
this.engine.drawPolygon([
|
|
|
new SPoint(-d, d / 2),
|
|
|
new SPoint(0, d / 2),
|
|
|
new SPoint(0, -d / 2),
|
|
|
new SPoint(-d, -d / 2)
|
|
|
]);
|
|
|
- this.restore();
|
|
|
} else {
|
|
|
- this.save();
|
|
|
this.translate(line.x1, line.y1);
|
|
|
- this.rotate(ang);
|
|
|
+ this.rotate((fo * 180) / Math.PI);
|
|
|
this.engine.drawPolygon([
|
|
|
new SPoint(0, d / 2),
|
|
|
new SPoint(d, d / 2),
|
|
|
new SPoint(d, -d / 2),
|
|
|
new SPoint(0, -d / 2)
|
|
|
]);
|
|
|
- this.restore();
|
|
|
}
|
|
|
+ this.restore();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -834,23 +822,20 @@ export class SPainter extends SObject {
|
|
|
* */
|
|
|
private drawCircleArrow(line: SLine, isEnd: boolean = true): void {
|
|
|
|
|
|
- const d = 2;
|
|
|
+ const d = this.toPx(5);
|
|
|
|
|
|
const fo = Math.atan(line.dy / line.dx);
|
|
|
- const ang = line.dx >= 0 ? fo : fo + Math.PI;
|
|
|
|
|
|
+ this.save();
|
|
|
if (isEnd) {
|
|
|
- this.save();
|
|
|
this.translate(line.x2, line.y2);
|
|
|
- this.rotate(ang);
|
|
|
+ this.rotate((fo * 180) / Math.PI);
|
|
|
this.engine.drawCircle(-d / 2, 0, d / 2);
|
|
|
- this.restore();
|
|
|
} else {
|
|
|
- this.save();
|
|
|
this.translate(line.x1, line.y1);
|
|
|
- this.rotate(ang);
|
|
|
+ this.rotate((fo * 180) / Math.PI);
|
|
|
this.engine.drawCircle(d / 2, 0, d / 2);
|
|
|
- this.restore();
|
|
|
}
|
|
|
+ this.restore();
|
|
|
}
|
|
|
}
|