Browse Source

Merge branch 'master' of http://face3d.4dage.com:7005/bill/drawing-board

gemercheung 1 year ago
parent
commit
acaac28581

+ 1 - 1
src/board/env.ts

@@ -1 +1 @@
-export const DEV = true;
+export const DEV = false;

+ 0 - 1
src/board/packages/whole-line/editable/pen-whole-line.ts

@@ -197,7 +197,6 @@ export class PenEditWholeLine<
         autoClose: this.autoClose,
         config: this.attrib,
         changePolygon: (pid: string) => {
-          console.error("changePolygon", pid);
           this.editPolygonId.value = pid;
         },
         quitHandler: () => {

+ 18 - 16
src/board/packages/whole-line/service/whole-line-edit.ts

@@ -135,7 +135,7 @@ export const penWholeLinePoygonsEdit = <
       );
     });
     const child = target && tree.find(target.id());
-    const pixel = [evt.evt.x, evt.evt.y];
+    const pixel = [evt.evt.offsetX, evt.evt.offsetY];
 
     if (child instanceof WholeLineLine) {
       if (!canOper || canOper(child, evt.target)) {
@@ -162,23 +162,25 @@ export const penWholeLinePoygonsEdit = <
       }
     }
     const polygonPoints = getWholeLinePolygonPoints(config, polyginAttrib.id);
-    let position: number[];
-    if (adsorbRadius) {
-      const points = polygonPoints.map(({ x, y }) => [x, y]);
-      if (prevId) {
-        const prev = getWholeLinePoint(config, prevId);
-        points.push([prev.x, prev.y]);
+    if (!pointAttrib) {
+      let position: number[];
+      if (adsorbRadius) {
+        const points = polygonPoints.map(({ x, y }) => [x, y]);
+        if (prevId) {
+          const prev = getWholeLinePoint(config, prevId);
+          points.push([prev.x, prev.y]);
+        }
+        position = getAdsorbPosition({
+          tree,
+          pixel,
+          radius: adsorbRadius,
+          points,
+        });
+      } else {
+        position = tree.getRealFromStage(pixel);
       }
-      position = getAdsorbPosition({
-        tree,
-        pixel,
-        radius: adsorbRadius,
-        points,
-      });
-    } else {
-      position = tree.getRealFromStage(pixel);
+      pointAttrib = pointAttribFactory(position) as P & Attrib;
     }
-    pointAttrib = pointAttribFactory(position) as P & Attrib;
 
     const curNdx = polygonPoints.findIndex(({ id }) => id === pointAttrib.id);
     const isClose = curNdx === 0 && (!autoClose || polygonPoints.length >= 3);