From 45561c2228efa13c22c6d7c8cb1c9d67e706f09a Mon Sep 17 00:00:00 2001 From: Val Erastov Date: Mon, 9 Feb 2015 20:24:40 -0800 Subject: [PATCH] high-level constraints 2 --- web/app/parametric.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/web/app/parametric.js b/web/app/parametric.js index 76eda2e1..87662f95 100644 --- a/web/app/parametric.js +++ b/web/app/parametric.js @@ -26,6 +26,9 @@ TCAD.TWO.ParametricManager.prototype.remove = function(constr) { var p = this.system[i]; if (p.id === constr.id) { this.system.splice(i, 1); + if (p.NAME === 'coi') { + this.unlinkObjects(p.a, p.b); + } break; } } @@ -192,6 +195,21 @@ TCAD.TWO.ParametricManager.prototype.linkObjects = function(objs) { this.notify(); }; +TCAD.TWO.ParametricManager.prototype.unlinkObjects = function(a, b) { + + function _unlink(a, b) { + for (var i = 0; i < a.linked.length; ++i) { + var obj = a.linked[i]; + if (obj.id === b.id) { + a.linked.splice(i, 1); + break; + } + } + } + _unlink(a, b); + _unlink(b, a); +}; + TCAD.TWO.ParametricManager.prototype.coincident = function(objs) { if (objs.length == 0) return; this.linkObjects(objs);