in src/canvastools/ts/CanvasTools/Region/Path/AnchorsElement.ts [214:244]
protected onGhostPointerMove(e: PointerEvent) {
if (this.isModifyRegionOnlyModeEnabled(e) && this.activeAnchorIndex !== 0) {
const p = this.getActiveAnchorPoint(e);
let dist: number = Number.MAX_VALUE;
let index: number = -1;
this.regionData.points.forEach((point, i) => {
const d = p.squareDistanceToPoint(point);
if (d < dist) {
dist = d;
index = i;
}
});
const swapToDelete: boolean = dist < AnchorsElement.ANCHOR_POINT_LINE_SWITCH_THRESHOLD;
if (this.activeAnchorIndex <= 0 && !swapToDelete) {
this.ghostAnchorAction = GhostAnchorAction.Add;
this.activeAnchorIndex = -1;
} else if (
this.regionData.points.length > AnchorsElement.MIN_NUMBERS_OF_POINTS_PER_POLYGON &&
swapToDelete
) {
this.activeAnchorIndex = index + 1;
this.ghostAnchorAction = GhostAnchorAction.Delete;
}
} else {
this.ghostAnchorAction = GhostAnchorAction.None;
}
super.onGhostPointerMove(e);
}