|
@@ -95,9 +95,11 @@
|
|
|
});
|
|
|
this.update();
|
|
|
this.textItem.text = "x2";
|
|
|
- this.textItem.moveTo(18, 6);
|
|
|
+ this.textItem.moveTo(18, -6);
|
|
|
this.moveable = true;
|
|
|
this.selectable = true;
|
|
|
+ this.textItem.enabled = false;
|
|
|
+ this.img.enabled = false;
|
|
|
}
|
|
|
|
|
|
onMouseEnter(event: SMouseEvent): boolean {
|
|
@@ -119,6 +121,7 @@
|
|
|
*
|
|
|
* */
|
|
|
onMouseDown(event: SMouseEvent): boolean {
|
|
|
+ console.log(this.textItem)
|
|
|
if (this.status == SItemStatus.Normal) {
|
|
|
return super.onMouseDown(event);
|
|
|
} else if (this.status == SItemStatus.Edit) {
|
|
@@ -144,7 +147,6 @@
|
|
|
* @return 是否处理事件
|
|
|
* */
|
|
|
onDoubleClick(event: SMouseEvent): boolean {
|
|
|
- console.log('doubleclick');
|
|
|
this.status = SItemStatus.Edit;
|
|
|
return true;
|
|
|
} // Function onDoubleClick()
|
|
@@ -155,14 +157,10 @@
|
|
|
* @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()
|
|
|
|
|
@@ -179,7 +177,6 @@
|
|
|
painter.brush.color = SColor.Gray
|
|
|
}
|
|
|
painter.drawRect(this.boundingRect());
|
|
|
- // super.onDraw(painter);
|
|
|
} // Function onDraw()
|
|
|
}
|
|
|
|