|
@@ -80,6 +80,25 @@ export class SGraphSelectContainer extends SGraphItem {
|
|
|
minHeight: number = 0;
|
|
|
/** 最小高 */
|
|
|
maxHeight: number = Number.MAX_SAFE_INTEGER;
|
|
|
+ /** 边框颜色 */
|
|
|
+ _strokeColor: SColor = new SColor("#82C7FC");
|
|
|
+ /** 画笔颜色 */
|
|
|
+ get strokeColor(): SColor {
|
|
|
+ return this._strokeColor;
|
|
|
+ } // Get strokeColor
|
|
|
+ set strokeColor(v: SColor) {
|
|
|
+ this._strokeColor = v;
|
|
|
+ this.update();
|
|
|
+ } // Set strokeColor
|
|
|
+ /** 填充颜色 */
|
|
|
+ _fillColor: SColor = new SColor("#ffffff");
|
|
|
+ get fillColor(): SColor {
|
|
|
+ return this._fillColor;
|
|
|
+ } // Get fillColor
|
|
|
+ set fillColor(v: SColor) {
|
|
|
+ this._fillColor = v;
|
|
|
+ this.update();
|
|
|
+ } // Set fillColor
|
|
|
/** 绘制矩形的圆角半径 */
|
|
|
/** 统计选中item的数量 */
|
|
|
get count(): number {
|
|
@@ -146,7 +165,7 @@ export class SGraphSelectContainer extends SGraphItem {
|
|
|
}
|
|
|
item.selected = true;
|
|
|
this.itemList.push(item);
|
|
|
- this.throttle(this.selectChange, 100);
|
|
|
+ this.throttle(this.selectChange, 80);
|
|
|
} // Function addItem()
|
|
|
|
|
|
/**
|
|
@@ -161,7 +180,7 @@ export class SGraphSelectContainer extends SGraphItem {
|
|
|
this.itemList.length = 0;
|
|
|
item.selected = true;
|
|
|
this.itemList.push(item);
|
|
|
- this.throttle(this.selectChange, 200);
|
|
|
+ this.throttle(this.selectChange, 80);
|
|
|
} // Function setItem()
|
|
|
|
|
|
/**
|
|
@@ -173,7 +192,7 @@ export class SGraphSelectContainer extends SGraphItem {
|
|
|
t.selected = false;
|
|
|
});
|
|
|
this.itemList.length = 0;
|
|
|
- this.throttle(this.selectChange, 200);
|
|
|
+ this.throttle(this.selectChange, 80);
|
|
|
} // Function clear()
|
|
|
|
|
|
/**
|
|
@@ -186,7 +205,7 @@ export class SGraphSelectContainer extends SGraphItem {
|
|
|
if (this.itemList[i] == item) {
|
|
|
this.itemList[i].selected = false;
|
|
|
this.itemList.splice(i, 1);
|
|
|
- this.throttle(this.selectChange, 200);
|
|
|
+ this.throttle(this.selectChange, 80);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -198,7 +217,7 @@ export class SGraphSelectContainer extends SGraphItem {
|
|
|
}
|
|
|
item.selected = true;
|
|
|
this.itemList.push(item);
|
|
|
- this.throttle(this.selectChange, 200);
|
|
|
+ this.throttle(this.selectChange, 80);
|
|
|
} // Function toggleItem()
|
|
|
|
|
|
/**
|
|
@@ -698,7 +717,12 @@ export class SGraphSelectContainer extends SGraphItem {
|
|
|
this.getSize();
|
|
|
// 计算边界8个点
|
|
|
this.calExtreme();
|
|
|
- this.visible = true;
|
|
|
+ if (
|
|
|
+ this.count > 1 ||
|
|
|
+ (this.count == 1 && this.itemList[0].showSelect)
|
|
|
+ ) {
|
|
|
+ this.visible = true;
|
|
|
+ }
|
|
|
} else {
|
|
|
this.visible = false;
|
|
|
this.curIndex = -1;
|
|
@@ -838,7 +862,11 @@ export class SGraphSelectContainer extends SGraphItem {
|
|
|
*/
|
|
|
onMouseMove(event: SMouseEvent): boolean {
|
|
|
this.setCursor(9);
|
|
|
- if (this.curIndex > -1 && this.count == 1) {
|
|
|
+ if (
|
|
|
+ this.curIndex > -1 &&
|
|
|
+ this.count == 1 &&
|
|
|
+ this.itemList[0]._resizeable
|
|
|
+ ) {
|
|
|
this.setCursor(this.curIndex);
|
|
|
// @ts-ignore
|
|
|
const difX = event.x - this.curPoint.x;
|
|
@@ -980,24 +1008,30 @@ export class SGraphSelectContainer extends SGraphItem {
|
|
|
onDraw(painter: SPainter): void {
|
|
|
// 缓存场景长度
|
|
|
this.sceneDis = painter.toPx(this.dis);
|
|
|
- painter.pen.lineWidth = painter.toPx(1);
|
|
|
- painter.pen.color = SColor.White;
|
|
|
- painter.brush.color = SColor.Transparent;
|
|
|
- painter.drawRect(0, 0, this.width, this.height);
|
|
|
-
|
|
|
- painter.pen.color = SColor.Black;
|
|
|
- painter.pen.lineDash = [painter.toPx(4), painter.toPx(4)];
|
|
|
- painter.drawRect(0, 0, this.width, this.height);
|
|
|
-
|
|
|
- const r = painter.toPx(this.radius);
|
|
|
- painter.pen.lineDash = [];
|
|
|
- this.pointList.forEach((t, i) => {
|
|
|
- if (i == this.curIndex) {
|
|
|
- painter.brush.color = new SColor("#409eff");
|
|
|
- } else {
|
|
|
- painter.brush.color = SColor.White;
|
|
|
- }
|
|
|
- painter.drawCircle(t.x, t.y, r);
|
|
|
- });
|
|
|
+ // 多选时 或者 只选择一个并且是需要显示选择器时 绘制
|
|
|
+ if (
|
|
|
+ this.count > 1 ||
|
|
|
+ (this.count == 1 && this.itemList[0].showSelect)
|
|
|
+ ) {
|
|
|
+ painter.pen.lineWidth = painter.toPx(1);
|
|
|
+ painter.pen.color = SColor.White;
|
|
|
+ painter.brush.color = SColor.Transparent;
|
|
|
+ painter.drawRect(0, 0, this.width, this.height);
|
|
|
+
|
|
|
+ painter.pen.color = this.strokeColor;
|
|
|
+ painter.pen.lineDash = [painter.toPx(4), painter.toPx(4)];
|
|
|
+ painter.drawRect(0, 0, this.width, this.height);
|
|
|
+
|
|
|
+ const r = painter.toPx(this.radius);
|
|
|
+ painter.pen.lineDash = [];
|
|
|
+ this.pointList.forEach((t, i) => {
|
|
|
+ if (i == this.curIndex) {
|
|
|
+ painter.brush.color = this.fillColor;
|
|
|
+ } else {
|
|
|
+ painter.brush.color = SColor.White;
|
|
|
+ }
|
|
|
+ painter.drawCircle(t.x, t.y, r);
|
|
|
+ });
|
|
|
+ }
|
|
|
} // Function onDraw()
|
|
|
} // Class SGraphSelectContainer
|