|
@@ -1,5 +1,5 @@
|
|
import { SIconTextItem } from '@saga-web/big/lib/items/SIconTextItem';
|
|
import { SIconTextItem } from '@saga-web/big/lib/items/SIconTextItem';
|
|
-import { ItemOrder } from '@saga-web/big/lib';
|
|
|
|
|
|
+import { ItemOrder, SItemStatus } from '@saga-web/big/lib';
|
|
import { SFont, SColor } from '@saga-web/draw/lib';
|
|
import { SFont, SColor } from '@saga-web/draw/lib';
|
|
/**
|
|
/**
|
|
* 图例节点Item(图标类型)
|
|
* 图例节点Item(图标类型)
|
|
@@ -17,6 +17,8 @@ export class SImageLegendItem extends SIconTextItem {
|
|
super(parent, data.AnchorList);
|
|
super(parent, data.AnchorList);
|
|
/** 图例数量 */
|
|
/** 图例数量 */
|
|
this._num = 1;
|
|
this._num = 1;
|
|
|
|
+ /** 是否蒙版遮罩 */
|
|
|
|
+ this._maskFlag = false;
|
|
this.isTransform = false;
|
|
this.isTransform = false;
|
|
this.zOrder = ItemOrder.markOrder;
|
|
this.zOrder = ItemOrder.markOrder;
|
|
this.data = data;
|
|
this.data = data;
|
|
@@ -49,7 +51,7 @@ export class SImageLegendItem extends SIconTextItem {
|
|
this.sHeight = data.Properties.sHeight;
|
|
this.sHeight = data.Properties.sHeight;
|
|
}
|
|
}
|
|
if (data.Properties && data.Properties.font) {
|
|
if (data.Properties && data.Properties.font) {
|
|
- this.font = new SFont("sans-serif", data.Properties.font);
|
|
|
|
|
|
+ this.font = new SFont('sans-serif', data.Properties.font);
|
|
}
|
|
}
|
|
if (data.Properties && data.Properties.color) {
|
|
if (data.Properties && data.Properties.color) {
|
|
this.color = new SColor(data.Properties.color);
|
|
this.color = new SColor(data.Properties.color);
|
|
@@ -80,6 +82,16 @@ export class SImageLegendItem extends SIconTextItem {
|
|
this.text = `${this.data.Name}${this.data.Num > 1 ? ` × ${this.data.Num}` : ''}`;
|
|
this.text = `${this.data.Name}${this.data.Num > 1 ? ` × ${this.data.Num}` : ''}`;
|
|
this.update();
|
|
this.update();
|
|
}
|
|
}
|
|
|
|
+ get maskFlag() {
|
|
|
|
+ return this._maskFlag;
|
|
|
|
+ }
|
|
|
|
+ set maskFlag(v) {
|
|
|
|
+ if (v === this._maskFlag) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this._maskFlag = v;
|
|
|
|
+ this.update();
|
|
|
|
+ }
|
|
toData() {
|
|
toData() {
|
|
this.data.Pos = { X: this.x, Y: this.y };
|
|
this.data.Pos = { X: this.x, Y: this.y };
|
|
this.data.Size = { Width: this.width, Height: this.height };
|
|
this.data.Size = { Width: this.width, Height: this.height };
|
|
@@ -93,15 +105,34 @@ export class SImageLegendItem extends SIconTextItem {
|
|
this.data.Properties.color = this.color.value;
|
|
this.data.Properties.color = this.color.value;
|
|
this.data.Properties.FrameColor = this.activeColor.value;
|
|
this.data.Properties.FrameColor = this.activeColor.value;
|
|
this.data.Properties.IsActive = this.isActive;
|
|
this.data.Properties.IsActive = this.isActive;
|
|
- this.data.AnchorList = this.anchorList.map(t => {
|
|
|
|
|
|
+ this.data.AnchorList = this.anchorList.map((t) => {
|
|
return {
|
|
return {
|
|
ID: t.id,
|
|
ID: t.id,
|
|
Pos: {
|
|
Pos: {
|
|
X: t.x,
|
|
X: t.x,
|
|
- Y: t.y
|
|
|
|
- }
|
|
|
|
|
|
+ Y: t.y,
|
|
|
|
+ },
|
|
};
|
|
};
|
|
});
|
|
});
|
|
return this.data;
|
|
return this.data;
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Item绘制框架
|
|
|
|
+ *
|
|
|
|
+ * @param painter painter对象
|
|
|
|
+ * @param rect 绘制区域
|
|
|
|
+ */
|
|
|
|
+ onPaint(painter, rect) {
|
|
|
|
+ super.onPaint(painter, rect);
|
|
|
|
+ if (this.maskFlag && this.status == SItemStatus.Normal) {
|
|
|
|
+ painter.pen.color = SColor.Transparent;
|
|
|
|
+ painter.brush.color = new SColor("#ffffffa1");
|
|
|
|
+ if (this.selected) {
|
|
|
|
+ painter.drawCircle(this.img.x, this.img.y, (this.sWidth / 2.0) * 1.25);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ painter.drawCircle(this.img.x, this.img.y, this.sWidth / 2.0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } // Function onPaint()
|
|
} // Class SImageLegendItem
|
|
} // Class SImageLegendItem
|