Pārlūkot izejas kodu

设备图标item修改

haojianlong 4 gadi atpakaļ
vecāks
revīzija
2a6306da4a
3 mainītis faili ar 9 papildinājumiem un 4 dzēšanām
  1. 1 1
      package.json
  2. 1 1
      src/items/EditLineItem.ts
  3. 7 2
      src/items/IconTextItem.ts

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/cad-engine",
-    "version": "2.0.570",
+    "version": "2.0.571",
     "description": "上格云 CAD图形引擎。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",

+ 1 - 1
src/items/EditLineItem.ts

@@ -184,7 +184,7 @@ export class EditLineItem extends SGraphItem {
     /**
      * 点发生变化
      */
-    protected pointChange(): void {
+    pointChange(): void {
         if (this.line.length > 1) {
             const line = new SLine(
                 this.line[0].x,

+ 7 - 2
src/items/IconTextItem.ts

@@ -44,7 +44,7 @@ export class IconTextItem extends SGraphItem {
     }
 
     /** 是否显示文字 */
-    _showText: boolean = true;
+    _showText: boolean = false;
     get showText(): boolean {
         return this._showText;
     }
@@ -76,6 +76,7 @@ export class IconTextItem extends SGraphItem {
             return;
         }
         this._selected = value;
+        this.showText = value;
         // 选中时
         if (value) {
             this.img.scale = 1.25;
@@ -214,9 +215,13 @@ export class IconTextItem extends SGraphItem {
         this.img.url = IconTextItem.imgSource;
         this.img.origin = new SPoint(14, 33);
         this.isTransform = false;
+        this.zOrder = ItemOrder.markOrder;
+        this.selectable = true;
         if (data.text && data.text.length) {
             data.text.forEach((it: string) => {
                 const textItem = new STextItem(this, it);
+                textItem.visible = false;
+                textItem.origin = new SPoint(-15, 37);
                 this.addTextItem(textItem);
             });
         }
@@ -291,7 +296,7 @@ export class IconTextItem extends SGraphItem {
         const rect = this.boundingRect();
         const lw = painter.toPx(1);
         // 编辑态和选中态出现绘制区域
-        if (this.status == SItemStatus.Edit || this.selected) {
+        if (this.status == SItemStatus.Edit) {
             // doto 如果子元素被选中
             painter.pen.lineWidth = lw;
             painter.pen.lineDash = [3 * lw, 7 * lw];