|
@@ -83,39 +83,39 @@ export class DoorItem extends SGraphItem {
|
|
|
}
|
|
|
);
|
|
|
|
|
|
- let p1 = this.pointArr[0],
|
|
|
- p2 = this.pointArr[1];
|
|
|
- // 旋转点
|
|
|
- this.p = p1;
|
|
|
- const HX = (this.data.HandDirection.X = Number(
|
|
|
- this.data.HandDirection.X.toFixed()
|
|
|
- ));
|
|
|
- const HY = (this.data.HandDirection.Y = Number(
|
|
|
- this.data.HandDirection.Y.toFixed()
|
|
|
- ));
|
|
|
- const FX = (this.data.FaceDirection.X = Number(
|
|
|
- this.data.FaceDirection.X.toFixed()
|
|
|
- ));
|
|
|
- const FY = (this.data.FaceDirection.Y = Number(
|
|
|
- this.data.FaceDirection.Y.toFixed()
|
|
|
- ));
|
|
|
- // 向量点乘 => x1 * x2 + y1 * y2,大于0同向
|
|
|
- let dotProduct = (p2.x - p1.x) * HX + (p2.y - p1.y) * -HY;
|
|
|
- if (dotProduct > 0) {
|
|
|
- this.p = p2;
|
|
|
- p2 = p1;
|
|
|
- p1 = this.p;
|
|
|
- }
|
|
|
- // 两点间距离
|
|
|
- this.r = SMathUtil.pointDistance(p1.x, p1.y, p2.x, p2.y);
|
|
|
- // 门朝向角度
|
|
|
- let fo = Math.atan(-FY / FX);
|
|
|
- this.ang = FX > 0 ? fo : fo + Math.PI;
|
|
|
- // 向量叉乘 => x1 * y2 - x2 * y1,小于0是顺时针
|
|
|
- let direction = (p2.x - p1.x) * -FY - (p2.y - p1.y) * FX;
|
|
|
- if (direction > 0) {
|
|
|
- this.startAng = 0;
|
|
|
- }
|
|
|
+ // let p1 = this.pointArr[0],
|
|
|
+ // p2 = this.pointArr[1];
|
|
|
+ // // 旋转点
|
|
|
+ // this.p = p1;
|
|
|
+ // const HX = (this.data.HandDirection.X = Number(
|
|
|
+ // this.data.HandDirection.X.toFixed()
|
|
|
+ // ));
|
|
|
+ // const HY = (this.data.HandDirection.Y = Number(
|
|
|
+ // this.data.HandDirection.Y.toFixed()
|
|
|
+ // ));
|
|
|
+ // const FX = (this.data.FaceDirection.X = Number(
|
|
|
+ // this.data.FaceDirection.X.toFixed()
|
|
|
+ // ));
|
|
|
+ // const FY = (this.data.FaceDirection.Y = Number(
|
|
|
+ // this.data.FaceDirection.Y.toFixed()
|
|
|
+ // ));
|
|
|
+ // // 向量点乘 => x1 * x2 + y1 * y2,大于0同向
|
|
|
+ // let dotProduct = (p2.x - p1.x) * HX + (p2.y - p1.y) * -HY;
|
|
|
+ // if (dotProduct > 0) {
|
|
|
+ // this.p = p2;
|
|
|
+ // p2 = p1;
|
|
|
+ // p1 = this.p;
|
|
|
+ // }
|
|
|
+ // // 两点间距离
|
|
|
+ // this.r = SMathUtil.pointDistance(p1.x, p1.y, p2.x, p2.y);
|
|
|
+ // // 门朝向角度
|
|
|
+ // let fo = Math.atan(-FY / FX);
|
|
|
+ // this.ang = FX > 0 ? fo : fo + Math.PI;
|
|
|
+ // // 向量叉乘 => x1 * y2 - x2 * y1,小于0是顺时针
|
|
|
+ // let direction = (p2.x - p1.x) * -FY - (p2.y - p1.y) * FX;
|
|
|
+ // if (direction > 0) {
|
|
|
+ // this.startAng = 0;
|
|
|
+ // }
|
|
|
}
|
|
|
} // Constructor
|
|
|
|
|
@@ -139,13 +139,14 @@ export class DoorItem extends SGraphItem {
|
|
|
* @param painter painter对象
|
|
|
*/
|
|
|
onDraw(painter: SPainter): void {
|
|
|
- painter.translate(this.p.x, this.p.y);
|
|
|
- painter.rotate(this.ang);
|
|
|
- painter.pen.lineWidth = 100;
|
|
|
- painter.pen.color = Opt.doorColor;
|
|
|
- painter.drawLine(0, 0, this.r, 0);
|
|
|
- painter.pen.lineDash = [50, 100];
|
|
|
- painter.pen.lineWidth = 50;
|
|
|
+ // painter.translate(this.p.x, this.p.y);
|
|
|
+ // painter.rotate(this.ang);
|
|
|
+ // painter.pen.lineWidth = 100;
|
|
|
+ // painter.pen.color = Opt.doorColor;
|
|
|
+ // painter.drawLine(0, 0, this.r, 0);
|
|
|
+ // painter.pen.lineDash = [50, 100];
|
|
|
+ // painter.pen.lineWidth = 50;
|
|
|
+
|
|
|
// painter.drawArc(
|
|
|
// -this.r,
|
|
|
// -this.r,
|
|
@@ -154,5 +155,8 @@ export class DoorItem extends SGraphItem {
|
|
|
// this.startAng,
|
|
|
// this.startAng + Math.PI / 2
|
|
|
// );
|
|
|
+ painter.pen.lineWidth = this.data.Thick || 100;
|
|
|
+ painter.pen.color = Opt.doorColor;
|
|
|
+ painter.drawLine(this.pointArr[0], this.pointArr[1]);
|
|
|
} // Function onDraw()
|
|
|
} // Class DoorItem
|