|
@@ -41,7 +41,7 @@ import {
|
|
|
SFont,
|
|
|
SPoint
|
|
|
} from "@persagy-web/draw";
|
|
|
-import { SGraphEdit, SBaseTextEdit } from "..";
|
|
|
+import { SGraphEdit, SBaseTextEdit, SBaseImageEdit } from "..";
|
|
|
import { Marker } from "../type/Marker";
|
|
|
|
|
|
|
|
@@ -262,8 +262,9 @@ export class SBaseIconTextEdit extends SGraphEdit {
|
|
|
})
|
|
|
this.update();
|
|
|
}
|
|
|
+
|
|
|
|
|
|
- img: SImageItem = new SImageItem(this);
|
|
|
+ img: SBaseImageEdit = new SBaseImageEdit(this, {name: '', pos: {x: 0, y: 0}, type: '', style: {}});
|
|
|
|
|
|
|
|
|
textItemList: SBaseTextEdit[] = [];
|
|
@@ -276,6 +277,8 @@ export class SBaseIconTextEdit extends SGraphEdit {
|
|
|
*/
|
|
|
constructor(parent: SGraphItem | null, data: Marker | null = null) {
|
|
|
super(parent);
|
|
|
+ this.showSelect = false;
|
|
|
+ this.img.showSelect = false;
|
|
|
this.data = data;
|
|
|
}
|
|
|
|
|
@@ -320,10 +323,12 @@ export class SBaseIconTextEdit extends SGraphEdit {
|
|
|
);
|
|
|
}
|
|
|
obj.font.size = item.font;
|
|
|
- obj.strokeColor = new SColor(item.color);
|
|
|
+ obj.isTransform = false;
|
|
|
+ obj.showSelect = false;
|
|
|
+ obj.color = new SColor(item.color);
|
|
|
textItemList.push(obj)
|
|
|
})
|
|
|
- this.textItemList = textItemList
|
|
|
+ this.textItemList = textItemList;
|
|
|
}
|
|
|
}
|
|
|
this.img.url = this.data.style.default.url;
|
|
@@ -382,7 +387,8 @@ export class SBaseIconTextEdit extends SGraphEdit {
|
|
|
*/
|
|
|
onMouseDown(event: SMouseEvent): boolean {
|
|
|
if (this.status == SItemStatus.Normal) {
|
|
|
- return super.onMouseDown(event);
|
|
|
+ super.onMouseDown(event)
|
|
|
+ return true;
|
|
|
} else if (this.status == SItemStatus.Edit) {
|
|
|
return super.onMouseDown(event);
|
|
|
}
|
|
@@ -447,14 +453,26 @@ export class SBaseIconTextEdit extends SGraphEdit {
|
|
|
* @param painter 绘制对象
|
|
|
*/
|
|
|
onDraw(painter: SPainter): void {
|
|
|
- if (this.status == SItemStatus.Edit) {
|
|
|
- painter.pen.lineWidth = painter.toPx(1);
|
|
|
- painter.pen.lineDash = [painter.toPx(3), painter.toPx(7)];
|
|
|
+ const rect = this.boundingRect();
|
|
|
+ const lw = painter.toPx(1);
|
|
|
+
|
|
|
+ if (this.status == SItemStatus.Edit || this.selected) {
|
|
|
+
|
|
|
+ painter.pen.lineWidth = lw;
|
|
|
+ painter.pen.lineDash = [3*lw, 7*lw];
|
|
|
painter.pen.color = SColor.Black;
|
|
|
painter.brush.color = SColor.Transparent;
|
|
|
- painter.drawRect(this.boundingRect());
|
|
|
+ painter.drawRect(rect);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.status == SItemStatus.Edit) {
|
|
|
+ painter.pen.lineDash = [];
|
|
|
+ painter.brush.color = SColor.White;
|
|
|
+ painter.drawCircle(rect.x, rect.y, 5*lw)
|
|
|
+ painter.drawCircle(rect.right, rect.bottom, 5*lw)
|
|
|
+ painter.drawCircle(rect.x, rect.bottom, 5*lw)
|
|
|
+ painter.drawCircle(rect.right, rect.y, 5*lw)
|
|
|
}
|
|
|
-
|
|
|
if (this.isActive) {
|
|
|
painter.pen.color = SColor.Transparent;
|
|
|
painter.brush.color = this.activeColor;
|
|
@@ -499,7 +517,7 @@ export class SBaseIconTextEdit extends SGraphEdit {
|
|
|
this.data.size.width = this.sWidth;
|
|
|
this.data.size.height = this.sHeight;
|
|
|
}
|
|
|
- this.data.style.default.text = this.textItemList.text;
|
|
|
+ this.data.style.default.text = JSON.stringify(this.textItemList);
|
|
|
this.data.pos.x = this.pos.x;
|
|
|
this.data.pos.y = this.pos.y;
|
|
|
this.data.style.default.zorder = this.zOrder;
|