Browse Source

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-editer into develop

YaolongHan 4 years ago
parent
commit
ec9f1a99e1
1 changed files with 7 additions and 9 deletions
  1. 7 9
      src/lib/SImgTextItem.ts

+ 7 - 9
src/lib/SImgTextItem.ts

@@ -106,7 +106,9 @@ export class SImgTextItem extends SObjectItem {
     this.textItem.moveTo(16, -6);
     this.moveable = true;
     this.selectable = true;
-    this.isTransform = false
+    this.isTransform = false;
+    this.textItem.enabled = false;
+    this.img.enabled = false;
   }
 
   /**
@@ -150,14 +152,10 @@ export class SImgTextItem extends SObjectItem {
    * @return  SRect   所有子对象的并集
    * */
   boundingRect(): SRect {
-    let rect: SRect = new SRect();
-    this.children.forEach(t => {
-      if (rect.isNull()) {
-        rect = t.boundingRect().adjusted(t.pos.x, t.pos.y, 0, 0);
-      } else {
-        rect = rect.unioned(t.boundingRect().adjusted(t.pos.x, t.pos.y, 0, 0));
-      }
-    });
+    let rect = this.img.boundingRect().adjusted(this.img.pos.x,this.img.pos.y,0,0);
+    if (this.showText) {
+        rect = rect.unioned(this.textItem.boundingRect().adjusted(this.textItem.pos.x,this.textItem.pos.y,0,0))
+    }
     return rect;
   } // Function boundingRect()