|
@@ -8,7 +8,7 @@ import {
|
|
|
openEntityDrag,
|
|
|
wholeLineStyle,
|
|
|
} from "../../board";
|
|
|
-import { PolygonsPointAttrib } from "./type";
|
|
|
+import { pointColorMap, PointTypeEnum, PolygonsPointAttrib } from "./type";
|
|
|
import { Group } from "konva/lib/Group";
|
|
|
import { Text } from "konva/lib/shapes/Text";
|
|
|
import { Circle } from "konva/lib/shapes/Circle";
|
|
@@ -107,19 +107,21 @@ const pointActShapeFactory = (attrib: PolygonsPointAttrib, tree: PoPoint) => {
|
|
|
const group = new Group();
|
|
|
group.add(offsetGroup, wlp.shape);
|
|
|
|
|
|
+ const setColor = (color: string) => {
|
|
|
+ out.fill(color);
|
|
|
+ select.fill(color);
|
|
|
+ };
|
|
|
+
|
|
|
const result = {
|
|
|
shape: group,
|
|
|
common() {
|
|
|
- out.fill(attrib.rtk ? "rgba(230, 162, 60, 1)" : "#409EFF");
|
|
|
- select.fill(attrib.rtk ? "rgba(230, 162, 60, 1)" : "#409EFF");
|
|
|
wlp.common();
|
|
|
label.visible(false);
|
|
|
},
|
|
|
hover: () => {
|
|
|
label.visible(true);
|
|
|
if (!attrib.rtk) {
|
|
|
- out.fill("#409EFF");
|
|
|
- select.fill("#409EFF");
|
|
|
+ setColor("#409EFF");
|
|
|
}
|
|
|
},
|
|
|
setData(data: number[]) {
|
|
@@ -128,6 +130,12 @@ const pointActShapeFactory = (attrib: PolygonsPointAttrib, tree: PoPoint) => {
|
|
|
group.x(data[0]);
|
|
|
group.y(data[1]);
|
|
|
text.text(tree.attrib.title || `P${attrib.id}`);
|
|
|
+ setColor(
|
|
|
+ !tree.attrib.rtk
|
|
|
+ ? pointColorMap[PointTypeEnum.mapSelect]
|
|
|
+ : pointColorMap[tree.attrib.type] ||
|
|
|
+ pointColorMap[PointTypeEnum.other]
|
|
|
+ );
|
|
|
|
|
|
if (~tree.editPolygonNdx) {
|
|
|
index.text((tree.editPolygonNdx + 1).toString()).visible(true);
|
|
@@ -142,8 +150,7 @@ const pointActShapeFactory = (attrib: PolygonsPointAttrib, tree: PoPoint) => {
|
|
|
},
|
|
|
draging() {
|
|
|
if (~tree.editPolygonNdx) {
|
|
|
- out.fill("#e0403c");
|
|
|
- select.fill("#e0403c");
|
|
|
+ setColor("#e0403c");
|
|
|
}
|
|
|
},
|
|
|
};
|