|
@@ -11,12 +11,14 @@ import {
|
|
|
fixWholeLineConfig,
|
|
|
getWholeLineLine,
|
|
|
getWholeLineLinesRawByPoint,
|
|
|
+ getWholeLinePolygonLinesByPoint,
|
|
|
getWholeLinePolygonPoints,
|
|
|
getWholeLinePolygonRaw,
|
|
|
mergeWholeLinePointsByPoint,
|
|
|
penWholeLinePoygonsEditWithHelperShapesMouse,
|
|
|
repeatMoveWholeLineLine,
|
|
|
spliceWholeLineLineByPoint,
|
|
|
+ updateConstant,
|
|
|
wholeLineDelPolygon,
|
|
|
} from "../service";
|
|
|
import {
|
|
@@ -42,7 +44,7 @@ export class EditWholeLine<
|
|
|
EntityDragHandlers<WholeLineLineAttrib, (move: number[]) => void>
|
|
|
>;
|
|
|
pointDragHandler: Required<
|
|
|
- EntityDragHandlers<WholeLinePointAttrib, number[]>
|
|
|
+ EntityDragHandlers<WholeLinePointAttrib, number[][][]>
|
|
|
>;
|
|
|
|
|
|
diffRedraw() {
|
|
@@ -95,7 +97,7 @@ export class EditWholeLine<
|
|
|
quotePoint: true,
|
|
|
autoClose: false,
|
|
|
tree: this.container,
|
|
|
- adsorbRadius: 10,
|
|
|
+ adsorbRadius: getRealAbsoluteSize(this.shape, [5, 5], true)[0],
|
|
|
config: this.attrib,
|
|
|
changePolygon: (pid) => {
|
|
|
if (pid) {
|
|
@@ -104,6 +106,7 @@ export class EditWholeLine<
|
|
|
},
|
|
|
quitHandler: () => {
|
|
|
this.container.bus.emit("dataChangeAfter");
|
|
|
+ this.endCreatePolygon = null;
|
|
|
for (const pid of prePolygonIds) {
|
|
|
const polygonAttrib = getWholeLinePolygonRaw(this.attrib, pid);
|
|
|
if (!polygonAttrib) return;
|
|
@@ -134,6 +137,7 @@ export class EditWholeLine<
|
|
|
}
|
|
|
|
|
|
pointAfterHandler(pointAttrib: WholeLinePointAttrib) {
|
|
|
+ updateConstant(getRealAbsoluteSize(this.container.stage, [1, 1], true)[0]);
|
|
|
const merge = mergeWholeLinePointsByPoint(this.attrib, pointAttrib.id);
|
|
|
spliceWholeLineLineByPoint(
|
|
|
this.attrib,
|
|
@@ -143,6 +147,7 @@ export class EditWholeLine<
|
|
|
}
|
|
|
|
|
|
lineAfterHandler(lineAttrib: WholeLineLineAttrib) {
|
|
|
+ updateConstant(getRealAbsoluteSize(this.container.stage, [1, 1], true)[0]);
|
|
|
for (let i = 0; i < lineAttrib.pointIds.length; i++) {
|
|
|
spliceWholeLineLineByPoint(this.attrib, lineAttrib.pointIds[i]);
|
|
|
}
|
|
@@ -150,6 +155,7 @@ export class EditWholeLine<
|
|
|
}
|
|
|
|
|
|
polygonAfterHandler(polygonAttrib: WholeLinePolygonAttrib) {
|
|
|
+ updateConstant(getRealAbsoluteSize(this.container.stage, [1, 1], true)[0]);
|
|
|
getWholeLinePolygonPoints(this.attrib, polygonAttrib.id).forEach(
|
|
|
(attrib) => {
|
|
|
if (this.attrib.points.includes(attrib)) {
|
|
@@ -183,21 +189,38 @@ export class EditWholeLine<
|
|
|
|
|
|
this.pointDragHandler = {
|
|
|
readyHandler: (attrib) => {
|
|
|
- // this.container.tempDraw(...this.getChildByPointsAttrib([attrib]));
|
|
|
this.container.bus.emit("dataChangeBefore");
|
|
|
- return [attrib.x, attrib.y];
|
|
|
+ const polygons = getWholeLinePolygonLinesByPoint(
|
|
|
+ this.attrib,
|
|
|
+ attrib.id
|
|
|
+ );
|
|
|
+ const pointsArray = polygons.map(({ polygonId }) => {
|
|
|
+ let points = getWholeLinePolygonPoints(this.attrib, polygonId);
|
|
|
+ const startNdx = points.indexOf(attrib);
|
|
|
+ points = [
|
|
|
+ ...points.slice(startNdx, points.length - 1),
|
|
|
+ ...points.slice(0, startNdx),
|
|
|
+ ];
|
|
|
+ return points.map((point) => [point.x, point.y]);
|
|
|
+ });
|
|
|
+ return pointsArray;
|
|
|
},
|
|
|
- moveHandler: (pointAttrib, move) => {
|
|
|
+ moveHandler: (pointAttrib, move, pointsArray) => {
|
|
|
const exclusionIds = getWholeLineLinesRawByPoint(
|
|
|
this.attrib,
|
|
|
pointAttrib
|
|
|
).map((line) => WholeLineLine.namespace + line.id);
|
|
|
exclusionIds.push(WholeLinePoint.namespace + pointAttrib.id);
|
|
|
|
|
|
- const [radius] = getRealAbsoluteSize(this.container.stage, [10, 10]);
|
|
|
+ const [radius] = getRealAbsoluteSize(
|
|
|
+ this.container.stage,
|
|
|
+ [10, 10],
|
|
|
+ true
|
|
|
+ );
|
|
|
const [radiusInner] = getRealAbsoluteSize(
|
|
|
this.container.stage,
|
|
|
- [500, 500]
|
|
|
+ [500, 500],
|
|
|
+ true
|
|
|
);
|
|
|
|
|
|
const position = getAdsorbPosition({
|
|
@@ -205,6 +228,7 @@ export class EditWholeLine<
|
|
|
position: move,
|
|
|
radius,
|
|
|
radiusInner,
|
|
|
+ pointsArray,
|
|
|
exclusionIds: exclusionIds,
|
|
|
});
|
|
|
pointAttrib.x = position[0];
|