|
@@ -1,7 +1,6 @@
|
|
|
import { SObjectItem } from "./SObjectItem";
|
|
|
import { SPainter, SRect, SColor, SFont } from "@saga-web/draw/lib";
|
|
|
import { SGraphItem } from "../SGraphItem";
|
|
|
-import { SLineStyle } from "../enums/SLineStyle";
|
|
|
|
|
|
/**
|
|
|
* 文本item
|
|
@@ -49,33 +48,25 @@ export class STextItem extends SObjectItem {
|
|
|
this.update();
|
|
|
}
|
|
|
|
|
|
- /** 边框宽度 */
|
|
|
- private _borderWidth: number = 1;
|
|
|
- get borderWidth(): number {
|
|
|
- return this._borderWidth;
|
|
|
- }
|
|
|
- set borderWidth(v: number) {
|
|
|
- this._borderWidth = v;
|
|
|
- this.update();
|
|
|
- }
|
|
|
-
|
|
|
/** 边框色 */
|
|
|
- private _borderColor: string = "#00000000";
|
|
|
- get borderColor(): string {
|
|
|
- return this._borderColor;
|
|
|
+ private _strokeColor: string = "#00000000";
|
|
|
+ get strokeColor(): string {
|
|
|
+ return this._strokeColor;
|
|
|
}
|
|
|
- set borderColor(v: string) {
|
|
|
- this._borderColor = v;
|
|
|
+ set strokeColor(v: string) {
|
|
|
+ this._strokeColor = v;
|
|
|
this.update();
|
|
|
}
|
|
|
|
|
|
- /** 边框样式 */
|
|
|
- private _borderStyle: SLineStyle = SLineStyle.Soild;
|
|
|
- get borderStyle(): SLineStyle {
|
|
|
- return this._borderStyle;
|
|
|
+ private _showBorder: boolean = false;
|
|
|
+ get showBorder(): boolean {
|
|
|
+ return this._showBorder;
|
|
|
}
|
|
|
- set borderStyle(v: SLineStyle) {
|
|
|
- this._borderStyle = v;
|
|
|
+ set showBorder(v: boolean) {
|
|
|
+ if (this._showBorder === v) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this._showBorder = v;
|
|
|
this.update();
|
|
|
}
|
|
|
|
|
@@ -111,21 +102,11 @@ export class STextItem extends SObjectItem {
|
|
|
*/
|
|
|
protected drawShowText(painter: SPainter): void {
|
|
|
//绘制矩形轮廓
|
|
|
- painter.brush.color = new SColor(this.backgroundColor);
|
|
|
- painter.pen.color = new SColor(this.borderColor);
|
|
|
- painter.pen.lineWidth = painter.toPx(this.borderWidth);
|
|
|
- if (this.borderStyle == SLineStyle.Dashed) {
|
|
|
- painter.pen.lineDash = [
|
|
|
- painter.toPx(this.borderWidth * 3),
|
|
|
- painter.toPx(this.borderWidth * 7)
|
|
|
- ];
|
|
|
- } else if (this.borderStyle == SLineStyle.Dotted) {
|
|
|
- painter.pen.lineDash = [
|
|
|
- painter.toPx(this.borderWidth),
|
|
|
- painter.toPx(this.borderWidth)
|
|
|
- ];
|
|
|
+ if (this.showBorder) {
|
|
|
+ painter.brush.color = new SColor(this.backgroundColor);
|
|
|
+ painter.pen.color = new SColor(this.strokeColor);
|
|
|
+ painter.drawRect(this.boundingRect());
|
|
|
}
|
|
|
- painter.drawRect(this.boundingRect());
|
|
|
|
|
|
//绘制文本
|
|
|
painter.brush.color = new SColor(this.color);
|