diff --git a/web/app/sketcher/main2d.js b/web/app/sketcher/main2d.js index dfe949e7..455fd0b6 100644 --- a/web/app/sketcher/main2d.js +++ b/web/app/sketcher/main2d.js @@ -163,6 +163,11 @@ TCAD.App2D = function() { app.viewer.parametricManager.solve([], 0, 4); app.viewer.refresh(); }); + + this.registerAction('CLEAN UP', "Clean All Draw", function () { + app.cleanUp(); + app.viewer.refresh(); + }); }; TCAD.App2D.prototype.loadFromLocalStorage = function() { @@ -176,8 +181,23 @@ TCAD.App2D.prototype.loadFromLocalStorage = function() { this.viewer.repaint(); }; +TCAD.App2D.prototype.cleanUp = function() { + for (var l = 0; l < this.viewer.layers.length; ++l) { + var layer = this.viewer.layers[l]; + if (layer.objects.length != 0) { + layer.objects = []; + } + } + if (this.viewer.parametricManager.system.length != 0) { + this.viewer.parametricManager.system = []; + this.viewer.parametricManager.notify(); + } +}; + TCAD.App2D.prototype.loadSketch = function(sketch) { + this.cleanUp(); + var index = {}; function endPoint(p) { diff --git a/web/test.html b/web/test.html index ae6e2644..ae65dc57 100644 --- a/web/test.html +++ b/web/test.html @@ -1,46 +1,61 @@ + +
-