// @ts-nocheck import { LineEle } from "../../map_element/element/Line" import { ActionManager } from "../../action/ActionManager" import type { Activeble } from "../../Common" import type { PlottingEle } from "./PlottingElement" import { LineEditor } from "../../editor/LineEditor" import { PolygonEditor } from "../../editor/PolygonEditor" export class PlottingEditor implements Activeble{ readonly plotting: PlottingEle; constructor(plotting: PlottingEle) { this.plotting = plotting; } active(): PlottingEditor { this.plotting.startEdit(); const marker = this.plotting.marker; if (marker != undefined) { ActionManager.newHelper(marker.id) .drag.active() .drag.onMove((helper, info) => marker.reposite(info.position)) } const area = this.plotting.area; LineEditor.unbindLine(); PolygonEditor.unbindPolygon(); if (area != undefined) { if (area instanceof LineEle) { LineEditor.bindLine(area).active(); } else { PolygonEditor.bindPolygon(area).active(); } } return this; } deactive(): PlottingEditor { this.plotting.stopEdit(); const marker = this.plotting.marker; if (marker != undefined) { ActionManager.removeHelper(marker.id); } LineEditor.unbindLine(); PolygonEditor.unbindPolygon(); return this; } }