|
@@ -162,31 +162,33 @@ export class SBaseLineEdit extends SGraphEdit {
|
|
|
super(parent);
|
|
|
this.showSelect = false;
|
|
|
this.data = data;
|
|
|
- if (data.style && data.style.default) {
|
|
|
+ if (data.style) {
|
|
|
// 关于顶点
|
|
|
- if (data.style.default.line) {
|
|
|
+ if (data.style.line) {
|
|
|
let setPointList: SPoint[];
|
|
|
- setPointList = data.style.default.line.map((i: { x: number; y: number; }) => {
|
|
|
+ setPointList = data.style.line.map((i: { x: number; y: number; }) => {
|
|
|
return new SPoint(i.x, i.y)
|
|
|
});
|
|
|
this.line = setPointList;
|
|
|
}
|
|
|
- // 颜色
|
|
|
- if (data.style.default.strokeColor) {
|
|
|
- this.strokeColor = new SColor(data.style.default.strokeColor)
|
|
|
- }
|
|
|
- // 颜色
|
|
|
- if (data.style.default.fillColor) {
|
|
|
- this.fillColor = new SColor(data.style.default.fillColor)
|
|
|
- }
|
|
|
- // 线宽
|
|
|
- if (data.style.default.lineWidth) {
|
|
|
- this.lineWidth = data.style.default.lineWidth
|
|
|
- }
|
|
|
-
|
|
|
- // 线样式
|
|
|
- if (data.style.default.lineStyle) {
|
|
|
- this.lineStyle = data.style.default.lineStyle
|
|
|
+ if (data.style.default) {
|
|
|
+ // 颜色
|
|
|
+ if (data.style.default.strokeColor) {
|
|
|
+ this.strokeColor = new SColor(data.style.default.strokeColor)
|
|
|
+ }
|
|
|
+ // 颜色
|
|
|
+ if (data.style.default.fillColor) {
|
|
|
+ this.fillColor = new SColor(data.style.default.fillColor)
|
|
|
+ }
|
|
|
+ // 线宽
|
|
|
+ if (data.style.default.lineWidth) {
|
|
|
+ this.lineWidth = data.style.default.lineWidth
|
|
|
+ }
|
|
|
+
|
|
|
+ // 线样式
|
|
|
+ if (data.style.default.lineStyle) {
|
|
|
+ this.lineStyle = data.style.default.lineStyle
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -243,7 +245,6 @@ export class SBaseLineEdit extends SGraphEdit {
|
|
|
if (event.shiftKey || this._verAndLeve) {
|
|
|
event = this.compare(event);
|
|
|
}
|
|
|
-
|
|
|
if (event.buttons == SMouseButton.LeftButton) {
|
|
|
if (this.status == SItemStatus.Normal) {
|
|
|
// return super.onMouseDown(event);
|
|
@@ -359,8 +360,8 @@ export class SBaseLineEdit extends SGraphEdit {
|
|
|
let dis = SMathUtil.pointDistance(
|
|
|
p.x,
|
|
|
p.y,
|
|
|
- this.line[i].x,
|
|
|
- this.line[i].y
|
|
|
+ this.line[i].x + this.x,
|
|
|
+ this.line[i].y + this.y
|
|
|
);
|
|
|
if (dis < len) {
|
|
|
len = dis;
|
|
@@ -394,7 +395,6 @@ export class SBaseLineEdit extends SGraphEdit {
|
|
|
t.y = t.y + this.y;
|
|
|
return t;
|
|
|
});
|
|
|
-
|
|
|
this.x = 0;
|
|
|
this.y = 0;
|
|
|
} // Function moveToOrigin()
|
|
@@ -530,7 +530,7 @@ export class SBaseLineEdit extends SGraphEdit {
|
|
|
toData(): any {
|
|
|
this.moveToOrigin()
|
|
|
const Line = [{ x: this.line[0].x, y: this.line[0].y }, { x: this.line[1].x, y: this.line[1].y }];
|
|
|
- this.data.style.default.line = Line;
|
|
|
+ this.data.style.line = Line;
|
|
|
this.data.style.default.lineWidth = this.lineWidth;
|
|
|
this.data.style.default.lineStyle = this.lineStyle;
|
|
|
this.data.style.default.strokeColor = this.strokeColor.value;
|