Parcourir la source

Merge branch 'master' of http://39.106.8.246:3003/web/sagacloud-web

haojianlong il y a 5 ans
Parent
commit
858593fa87
1 fichiers modifiés avec 4 ajouts et 17 suppressions
  1. 4 17
      saga-web-big/src/items/STextItem.ts

+ 4 - 17
saga-web-big/src/items/STextItem.ts

@@ -52,9 +52,6 @@ export class STextItem extends SObjectItem {
         this._text = str;
         this._font = new SFont("sans-serif", 12);
         this.height = 12;
-        this.moveable = true;
-        this.selectable = true;
-        this.selected = true;
     } // Constructor
 
     /**
@@ -67,16 +64,6 @@ export class STextItem extends SObjectItem {
     } // Function boundingRect()
 
     /**
-     * 判断点是否在区域内
-     *
-     * @param x
-     * @param y
-     */
-    contains(x: number, y: number): boolean {
-        return this.boundingRect().contains(x, y);
-    } // Function contains()
-
-    /**
      * 绘制编辑和创建状态文本Item
      *
      * @param painter    绘制类
@@ -125,16 +112,16 @@ export class STextItem extends SObjectItem {
         let textMaxWidth = 0;
         let textHeight: number = this.font.size;
         textArr.forEach((text: string, index: number) => {
-            let textWidth: number = painter.textWidth(text);
-            if (textWidth > textMaxWidth) {
-                textMaxWidth = textWidth;
-            }
             painter.drawText(
                 text,
                 0,
                 index * (textHeight + 2) + 2,
                 this.maxWidth
             );
+            let textWidth: number = painter.textWidth(text);
+            if (textWidth > textMaxWidth) {
+                textMaxWidth = textWidth;
+            }
         });
         // 在绘制文本后计算文本的宽高
         this.width = textMaxWidth;