|
@@ -31,7 +31,6 @@ export class SLineItem extends SGraphItem {
|
|
}
|
|
}
|
|
set line(arr: SPoint[]) {
|
|
set line(arr: SPoint[]) {
|
|
this._line = arr;
|
|
this._line = arr;
|
|
- this._xyzListToSPointList(arr);
|
|
|
|
this.update();
|
|
this.update();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -147,7 +146,6 @@ export class SLineItem extends SGraphItem {
|
|
this.releaseItem();
|
|
this.releaseItem();
|
|
this.$emit("finishCreated");
|
|
this.$emit("finishCreated");
|
|
}
|
|
}
|
|
- this._xyzListToSPointList(this.line);
|
|
|
|
this.update();
|
|
this.update();
|
|
} // Function addPoint()
|
|
} // Function addPoint()
|
|
|
|
|
|
@@ -241,7 +239,6 @@ export class SLineItem extends SGraphItem {
|
|
} else {
|
|
} else {
|
|
return super.onMouseMove(event);
|
|
return super.onMouseMove(event);
|
|
}
|
|
}
|
|
- this._xyzListToSPointList(this.line);
|
|
|
|
this.update();
|
|
this.update();
|
|
return true;
|
|
return true;
|
|
} // Function onMouseMove()
|
|
} // Function onMouseMove()
|
|
@@ -272,36 +269,6 @@ export class SLineItem extends SGraphItem {
|
|
} // Function findNearestPoint()
|
|
} // Function findNearestPoint()
|
|
|
|
|
|
/**
|
|
/**
|
|
- * xyz数据转换为SPoint格式函数;获取外接矩阵参数
|
|
|
|
- *
|
|
|
|
- * @param arr 外层传入的数据PointList
|
|
|
|
- */
|
|
|
|
- protected _xyzListToSPointList(arr: SPoint[]): void {
|
|
|
|
- if (arr.length) {
|
|
|
|
- this.minX = Number.MAX_SAFE_INTEGER;
|
|
|
|
- this.maxX = Number.MIN_SAFE_INTEGER;
|
|
|
|
- this.minY = Number.MAX_SAFE_INTEGER;
|
|
|
|
- this.maxY = Number.MIN_SAFE_INTEGER;
|
|
|
|
- arr.forEach(it => {
|
|
|
|
- let x = it.x,
|
|
|
|
- y = it.y;
|
|
|
|
- if (x < this.minX) {
|
|
|
|
- this.minX = x;
|
|
|
|
- }
|
|
|
|
- if (y < this.minY) {
|
|
|
|
- this.minY = y;
|
|
|
|
- }
|
|
|
|
- if (x > this.maxX) {
|
|
|
|
- this.maxX = x;
|
|
|
|
- }
|
|
|
|
- if (y > this.maxY) {
|
|
|
|
- this.maxY = y;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
* 记录相关动作并推入栈中
|
|
* 记录相关动作并推入栈中
|
|
*
|
|
*
|
|
* @param SGraphCommand 相关命令类
|
|
* @param SGraphCommand 相关命令类
|
|
@@ -379,6 +346,28 @@ export class SLineItem extends SGraphItem {
|
|
* @return SRect
|
|
* @return SRect
|
|
*/
|
|
*/
|
|
boundingRect(): SRect {
|
|
boundingRect(): SRect {
|
|
|
|
+ if (this.line.length) {
|
|
|
|
+ this.minX = this.line[0].x;
|
|
|
|
+ this.maxX = this.line[0].x;
|
|
|
|
+ this.minY = this.line[0].y;
|
|
|
|
+ this.maxY = this.line[0].y;
|
|
|
|
+ this.line.forEach(it => {
|
|
|
|
+ let x = it.x,
|
|
|
|
+ y = it.y;
|
|
|
|
+ if (x < this.minX) {
|
|
|
|
+ this.minX = x;
|
|
|
|
+ }
|
|
|
|
+ if (y < this.minY) {
|
|
|
|
+ this.minY = y;
|
|
|
|
+ }
|
|
|
|
+ if (x > this.maxX) {
|
|
|
|
+ this.maxX = x;
|
|
|
|
+ }
|
|
|
|
+ if (y > this.maxY) {
|
|
|
|
+ this.maxY = y;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
return new SRect(
|
|
return new SRect(
|
|
this.minX,
|
|
this.minX,
|
|
this.minY,
|
|
this.minY,
|