high-level constraints 2

This commit is contained in:
Val Erastov 2015-02-09 20:24:40 -08:00
parent 2b09e15350
commit 45561c2228

View file

@ -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);