|
@@ -13,6 +13,8 @@ import {
|
|
penWholeLinePoygonsEditWithHelperShapesMouse,
|
|
penWholeLinePoygonsEditWithHelperShapesMouse,
|
|
getWholeLinePolygonLinesRaw,
|
|
getWholeLinePolygonLinesRaw,
|
|
WholeLineLine,
|
|
WholeLineLine,
|
|
|
|
+ getWholeLinePolygonPoints,
|
|
|
|
+ shapeParentsEq,
|
|
} from "../../board";
|
|
} from "../../board";
|
|
import { reactive } from "vue";
|
|
import { reactive } from "vue";
|
|
import { Point } from "./point";
|
|
import { Point } from "./point";
|
|
@@ -66,6 +68,7 @@ const lineActShapeFactory = (attrib: PolygonsLineAttrib, tree: any) => {
|
|
|
|
|
|
export type PolygonsStatus = {
|
|
export type PolygonsStatus = {
|
|
newModel: boolean;
|
|
newModel: boolean;
|
|
|
|
+ lightPolygonId?: string;
|
|
activePointId?: string;
|
|
activePointId?: string;
|
|
editPolygonId?: string;
|
|
editPolygonId?: string;
|
|
selectPoiIds: string[];
|
|
selectPoiIds: string[];
|
|
@@ -135,6 +138,9 @@ export class Polygons extends WholeLine<
|
|
|
|
|
|
private endEditPolygon: () => void;
|
|
private endEditPolygon: () => void;
|
|
editPolygon(polygonId?: string) {
|
|
editPolygon(polygonId?: string) {
|
|
|
|
+ if (this.endEditPolygon) {
|
|
|
|
+ console.log(this.endEditPolygon);
|
|
|
|
+ }
|
|
this.endEditPolygon && this.endEditPolygon();
|
|
this.endEditPolygon && this.endEditPolygon();
|
|
this.status.newModel = !polygonId;
|
|
this.status.newModel = !polygonId;
|
|
this.endEditPolygon = penWholeLinePoygonsEditWithHelperShapesMouse(
|
|
this.endEditPolygon = penWholeLinePoygonsEditWithHelperShapesMouse(
|
|
@@ -142,17 +148,26 @@ export class Polygons extends WholeLine<
|
|
polygonId,
|
|
polygonId,
|
|
pointAttribFactory: getPolygonPoint,
|
|
pointAttribFactory: getPolygonPoint,
|
|
canOper: (tree, operShape) => {
|
|
canOper: (tree, operShape) => {
|
|
- return (
|
|
|
|
- !tree.name.includes(WholeLinePoint.namespace) ||
|
|
|
|
- operShape.name() === "anchor-point"
|
|
|
|
|
|
+ if (!tree.name.includes(WholeLinePoint.namespace)) return true;
|
|
|
|
+ const polygonPoints = getWholeLinePolygonPoints(
|
|
|
|
+ this.attrib,
|
|
|
|
+ this.status.editPolygonId
|
|
|
|
+ );
|
|
|
|
+ const pointId = tree.attrib.id;
|
|
|
|
+ const exixts = polygonPoints.some(({ id }) => id === pointId);
|
|
|
|
+ return !!shapeParentsEq(
|
|
|
|
+ operShape,
|
|
|
|
+ (shape) =>
|
|
|
|
+ shape.name() === (exixts ? "anchor-point" : "anchor-move")
|
|
);
|
|
);
|
|
},
|
|
},
|
|
quitHandler: () => {
|
|
quitHandler: () => {
|
|
this.status.newModel = false;
|
|
this.status.newModel = false;
|
|
this.bus.emit("penEndHandler");
|
|
this.bus.emit("penEndHandler");
|
|
|
|
+ this.endEditPolygon = null;
|
|
},
|
|
},
|
|
canDelPoint: (p: any) => !p.rtk,
|
|
canDelPoint: (p: any) => !p.rtk,
|
|
- quotePoint: false,
|
|
|
|
|
|
+ quotePoint: (p: any) => p.rtk,
|
|
closeAutoQuit: true,
|
|
closeAutoQuit: true,
|
|
tree: this.container,
|
|
tree: this.container,
|
|
autoAdd: false,
|
|
autoAdd: false,
|