|
@@ -12,25 +12,6 @@ export class STextMarkerItem extends STextItem {
|
|
|
/** 标识对象数据 */
|
|
|
data: Marker;
|
|
|
|
|
|
- /** 边框宽度 */
|
|
|
- private _lineWidth: number = 1;
|
|
|
- get lineWidth(): number {
|
|
|
- return this._lineWidth;
|
|
|
- }
|
|
|
- set lineWidth(v: number) {
|
|
|
- this._lineWidth = v;
|
|
|
- this.update();
|
|
|
- }
|
|
|
-
|
|
|
- /** 边框样式 */
|
|
|
- private _borderStyle: SLineStyle = SLineStyle.None;
|
|
|
- get borderStyle(): SLineStyle {
|
|
|
- return this._borderStyle;
|
|
|
- }
|
|
|
- set borderStyle(v: SLineStyle) {
|
|
|
- this._borderStyle = v;
|
|
|
- this.update();
|
|
|
- }
|
|
|
/**
|
|
|
* 构造函数
|
|
|
*
|
|
@@ -52,13 +33,13 @@ export class STextMarkerItem extends STextItem {
|
|
|
this.text = data.Properties.Text;
|
|
|
}
|
|
|
if (data.Properties && data.Properties.Color) {
|
|
|
- this.color = data.Properties.Color
|
|
|
+ this.color = new SColor(data.Properties.Color);
|
|
|
}
|
|
|
if (data.Properties && data.Properties.Font) {
|
|
|
this.font = new SFont("sans-serif", data.Properties.Font);;
|
|
|
}
|
|
|
if (data.Properties && data.Properties.BackgroundColor) {
|
|
|
- this.backgroundColor = data.Properties.BackgroundColor
|
|
|
+ this.backgroundColor = new SColor(data.Properties.BackgroundColor);
|
|
|
}
|
|
|
} // Constructor
|
|
|
|
|
@@ -66,44 +47,9 @@ export class STextMarkerItem extends STextItem {
|
|
|
this.data.Pos = {X: this.x, Y: this.y};
|
|
|
this.data.Size = {Width: this.width, Height: this.height};
|
|
|
this.data.Properties.Text = this.text;
|
|
|
- this.data.Properties.Color = this.color;
|
|
|
- this.data.Properties.Font = this.font.size
|
|
|
- this.data.Properties.BackgroundColor = this.backgroundColor
|
|
|
+ this.data.Properties.Color = this.color.value;
|
|
|
+ this.data.Properties.Font = this.font.size;
|
|
|
+ this.data.Properties.BackgroundColor = this.backgroundColor.value;
|
|
|
return this.data;
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * Item绘制操作
|
|
|
- *
|
|
|
- * @param painter 绘画类
|
|
|
- */
|
|
|
- onDraw(painter: SPainter): void {
|
|
|
- // 绘制文本
|
|
|
- painter.brush.color = new SColor(this.color);
|
|
|
- painter.font = this.font;
|
|
|
- this.drawFormatText(painter);
|
|
|
- if (this.selected) {
|
|
|
- this.borderStyle = SLineStyle.Dashed;
|
|
|
- } else {
|
|
|
- this.borderStyle = SLineStyle.None;
|
|
|
- }
|
|
|
- if (this.borderStyle == SLineStyle.Dashed) {
|
|
|
- painter.pen.lineDash = [
|
|
|
- painter.toPx(this.lineWidth * 3),
|
|
|
- painter.toPx(this.lineWidth * 7)
|
|
|
- ];
|
|
|
- painter.brush.color = SColor.Transparent;
|
|
|
- painter.drawRect(this.boundingRect());
|
|
|
- } else if (this.borderStyle == SLineStyle.Dotted) {
|
|
|
- painter.pen.lineDash = [
|
|
|
- painter.toPx(this.lineWidth),
|
|
|
- painter.toPx(this.lineWidth)
|
|
|
- ];
|
|
|
- painter.brush.color = SColor.Transparent;
|
|
|
- painter.drawRect(this.boundingRect());
|
|
|
- } else if (this.borderStyle == SLineStyle.Soild) {
|
|
|
- painter.brush.color = SColor.Transparent;
|
|
|
- painter.drawRect(this.boundingRect());
|
|
|
- }
|
|
|
- } // Function onDraw()
|
|
|
} // Class STextMarkerItem
|