首页 > 代码库 > 批量图形操作,合并Undo

批量图形操作,合并Undo

因为有好几个同学问到如何将多个图形操作步骤合并成一个Undo,所以就增加了比较实用的 combineRegen 函数。

  • iOS 应用例(GiViewHelper *hlp)

    [hlp combineRegen:^{
        hlp.command = @"line{‘points‘:[10,10, 20,20, 20,10, 30,20]}";
        hlp.command = @"lines{‘points‘:[10,10, 20,20, 20,10, 30,20]}";
    }];
  • Android 应用例(IViewHelper hlp)

    hlp.combineRegen(new Runnable() {
        @Override
        public void run() {
            hlp.setCommand("line{‘points‘:[10,10, 20,20, 20,10, 30,20]}");
            hlp.setCommand("lines{‘points‘:[10,10, 20,20, 20,10, 30,20]}");
        }
    });
  • C# 应用例(WPFViewHelper hlp)

    hlp.CombineRegen(delegate()
    {
        hlp.Command = "line{‘points‘:[10,10, 20,20, 20,10, 30,20]}";
        hlp.Command = "lines{‘points‘:[10,10, 20,20, 20,10, 30,20]}";
    });

批量图形操作,合并Undo