"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SGraphPointListDelete = void 0; const index_1 = require("../index"); class SGraphPointListDelete extends index_1.SGraphCommand { constructor(scene, item, pointList, pos, index = null) { super(scene); this.item = item; this.index = index; this.pointList = pointList; this.pos = pos; this.command = "SGraphPointListDelete"; this.desc = `删除折点=${item.id}`; } redo() { if (this.index == null) { this.pointList.pop(); } else { this.pointList.splice(this.index, 1); } this.item.update(); } undo() { if (this.pos == null) return; if (this.index == null) { this.pointList.push(this.pos); } else { this.pointList.splice(this.index, 0, this.pos); } this.item.update(); } toString() { const pointList = `pointList=${JSON.stringify(this.pointList)}`; const pos = `pos=${JSON.stringify(this.pos)}`; const index = `index=${this.index}`; return `${index};\n${pos};\n${pointList}`; } } exports.SGraphPointListDelete = SGraphPointListDelete;