|
@@ -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);
|