"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CirclePainter = void 0;
class CirclePainter {
  points = [];
  historyStask = [];
  undo() {
    if (this.historyStask.length > 0) {
      this.historyStask.pop();
      this.points = this.historyStask.at(-1) || [];
      this.onChange?.(this.points);
    }
  }
  addPoint(position) {
    if (this.points.length > 1) {
      this.points.splice(this.points.length - 1, 1, position);
    } else {
      this.points.push(position);
    }
    this.historyStask.push([...this.points]);
    this.onChange?.(this.points);
  }
  getData() {
    if (this.points.length !== 2) {
      return false;
    }
    return this.points;
  }
}
exports.CirclePainter = CirclePainter;
//# sourceMappingURL=CirclePainter.js.map