|
@@ -200,7 +200,7 @@ export class SLineItem extends SGraphItem {
|
|
this.curPoint = null;
|
|
this.curPoint = null;
|
|
if (event.buttons == SMouseButton.LeftButton) {
|
|
if (event.buttons == SMouseButton.LeftButton) {
|
|
if (this.status == SItemStatus.Normal) {
|
|
if (this.status == SItemStatus.Normal) {
|
|
- return false;
|
|
|
|
|
|
+ return super.onMouseDown(event);
|
|
} else if (this.status == SItemStatus.Edit) {
|
|
} else if (this.status == SItemStatus.Edit) {
|
|
// 判断是否点击到端点上(获取端点索引值)
|
|
// 判断是否点击到端点上(获取端点索引值)
|
|
this.findNearestPoint(new SPoint(event.x, event.y));
|
|
this.findNearestPoint(new SPoint(event.x, event.y));
|
|
@@ -232,6 +232,9 @@ export class SLineItem extends SGraphItem {
|
|
this.curIndex
|
|
this.curIndex
|
|
]);
|
|
]);
|
|
}
|
|
}
|
|
|
|
+ } else if (this.status == SItemStatus.Normal) {
|
|
|
|
+ this.moveToOrigin(this.x, this.y);
|
|
|
|
+ return super.onMouseUp(event);
|
|
}
|
|
}
|
|
this.curIndex = -1;
|
|
this.curIndex = -1;
|
|
this.curPoint = null;
|
|
this.curPoint = null;
|
|
@@ -255,7 +258,7 @@ export class SLineItem extends SGraphItem {
|
|
this.line[this.curIndex].y = event.y;
|
|
this.line[this.curIndex].y = event.y;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- return false;
|
|
|
|
|
|
+ return super.onMouseMove(event);
|
|
}
|
|
}
|
|
this.update();
|
|
this.update();
|
|
return true;
|
|
return true;
|
|
@@ -298,6 +301,23 @@ export class SLineItem extends SGraphItem {
|
|
} // Function recordAction()
|
|
} // Function recordAction()
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 移动后处理所有坐标,并肩原点置为场景原点
|
|
|
|
+ *
|
|
|
|
+ * @param x x坐标
|
|
|
|
+ * @param y y坐标
|
|
|
|
+ * */
|
|
|
|
+ moveToOrigin(x: number, y: number): void {
|
|
|
|
+ super.moveToOrigin(x, y);
|
|
|
|
+ this.line = this.line.map(t => {
|
|
|
|
+ t.x = t.x + x;
|
|
|
|
+ t.y = t.y + y;
|
|
|
|
+ return t;
|
|
|
|
+ });
|
|
|
|
+ this.x = 0;
|
|
|
|
+ this.y = 0;
|
|
|
|
+ } // Function moveToOrigin()
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 判断点是否在区域内
|
|
* 判断点是否在区域内
|
|
*
|
|
*
|
|
* @param x
|
|
* @param x
|