mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-15 12:53:52 +01:00
high-level constraints 2
This commit is contained in:
parent
2b09e15350
commit
45561c2228
1 changed files with 18 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue