|
@@ -1,5 +1,5 @@
|
|
|
import { SObjectItem } from "./SObjectItem";
|
|
|
-import { SPainter, SRect, SColor, SFont, SPoint } from "@saga-web/draw/lib";
|
|
|
+import { SPainter, SRect, SColor, SFont } from "@saga-web/draw/lib";
|
|
|
import { SGraphItem } from "../SGraphItem";
|
|
|
import { SLineStyle } from "../enums/SLineStyle";
|
|
|
|
|
@@ -129,6 +129,7 @@ export class STextItem extends SObjectItem {
|
|
|
* @param painter 绘制类
|
|
|
*/
|
|
|
protected drawShowText(painter: SPainter): void {
|
|
|
+ painter.translate(-this.origin.x, -this.origin.y);
|
|
|
//绘制矩形轮廓
|
|
|
if (this.selected) {
|
|
|
painter.shadow.shadowBlur = 10;
|
|
@@ -141,7 +142,7 @@ export class STextItem extends SObjectItem {
|
|
|
painter.brush.color = this.backgroundColor;
|
|
|
painter.pen.lineWidth = this.lineWidth;
|
|
|
painter.pen.color = this.strokeColor;
|
|
|
- painter.drawRect(this.boundingRect());
|
|
|
+ painter.drawRect(0, 0, this.width, this.height);
|
|
|
|
|
|
//绘制文本
|
|
|
painter.brush.color = new SColor(this.color);
|
|
@@ -178,7 +179,6 @@ export class STextItem extends SObjectItem {
|
|
|
// 在绘制文本后计算文本的宽高
|
|
|
this.width = textMaxWidth;
|
|
|
this.height = (fontSize * 1.25) * this._textArr.length + (fontSize / 8);
|
|
|
- this.origin = new SPoint(this.width / 2, this.height / 2);
|
|
|
this._painter.restore();
|
|
|
}
|
|
|
} // Function drawFormatText()
|
|
@@ -189,7 +189,6 @@ export class STextItem extends SObjectItem {
|
|
|
* @param painter 绘画类
|
|
|
*/
|
|
|
onDraw(painter: SPainter): void {
|
|
|
- painter.translate(-this.origin.x, -this.origin.y);
|
|
|
if (!(this._painter instanceof SPainter)) {
|
|
|
this._painter = painter;
|
|
|
this.drawFormatText();
|