| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- /*
- * ********************************************************************************************************************
- *
- * :*$@@%$*: ;: ;; ;;
- * :@@%! :!@@%: %! ;%%@@%$ =@@@@@@@%; @%@@@%%%%@@@@@
- * :@%; :$= %%$$$%$$ ;$$ ;$@= !@$
- * =@! %! @ $=;% !@@@%: !$$$$$$$$$$$$$$=
- * =@* %! @ $= % %@= =%@! %=
- * *$%%! @@= ;=$%%%$*: %! @ $= % =%%%%%%@$ *%: =%
- * %@@!: !@@@%=$@@@@%! :*@@$: %! @ $= % $* ;@ @* :%*
- * ;@@! ;!!!;: ;@%: =======@%========* @ $$ % $%*****$@ :@$=*********=@$
- * $@* ;@@@%=!: *@*
- * =@$ ;;;!=%@@@@=! =@!
- * %@$: =@%: :*@@@* %@= Copyright (c) 2016-2019. 北京上格云技术有限公司
- * ;%@@$=$@@%* *@@@$=%@@%;
- * ::;:: ::;:: All rights reserved.
- *
- * ********************************************************************************************************************
- */
- import { SPoint } from "@saga-web/draw/lib";
- import { SGraphCommand, SGraphItem } from "../index";
- /**
- * 多边形、折线等相关顶点的位置插入命令
- *
- * @author 韩耀龙
- */
- export class SGraphPointListInsert extends SGraphCommand {
- /** 指向item对象 */
- item: SGraphItem;
- /** 当前位置 */
- pos: SPoint;
- /** 索引 */
- index: number | null;
- /** 顶点数组 */
- pointList: SPoint[];
- /**
- * 构造函数
- * @param item 指向item对象
- * @param pointList 顶点数组
- * @param pos 当前位置
- * @param index 索引
- */
- constructor(
- item: SGraphItem,
- pointList: SPoint[],
- pos: SPoint,
- index: number | null = null
- ) {
- super(null);
- this.item = item;
- this.pos = pos;
- this.index = index;
- this.pointList = pointList;
- } // Constructor
- /**
- * 执行重做操作执行
- */
- redo(): void {
- const point = new SPoint(this.pos.x, this.pos.y);
- if (this.index == null) {
- this.pointList.push(point);
- } else {
- this.pointList.splice(this.index, 0, point);
- }
- this.item.update();
- } // Function redo()
- /**
- * 执行取消操作执行
- */
- undo(): void {
- if (this.index == null) {
- this.pointList.pop();
- } else {
- this.pointList.splice(this.index, 1);
- }
- this.item.update();
- } // Function undo()
- } // Class SGraphPointListInsert()
|