import { mathUtil } from "../Util/MathUtil"; import { circleService } from "../Service/CircleService"; import { listenLayer } from "../ListenLayer"; export default class AddCircle { constructor() { this.newCircle = null; this.center = null; } setCenter(value) { this.center = {}; mathUtil.clonePoint(this.center, value); } buildCircle(position) { if (this.newCircle == null && !mathUtil.equalPoint(this.center, position)) { const radius = mathUtil.getDistance(this.center, position); this.newCircle = circleService.create(this.center, radius); } } updateCircle(position) { if (this.newCircle != null && !mathUtil.equalPoint(this.center, position)) { this.newCircle.setRadius(mathUtil.getDistance(this.center, position)); } } finish(position) { if (this.newCircle != null && mathUtil.equalPoint(this.center, position)) { dataService.deleteLine(this.newLine.vectorId); } } clear() { this.newCircle = null; this.center = null; } } const addCircle = new AddCircle(); export { addCircle };