|
@@ -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;
|