mirror of
https://github.com/xibyte/jsketcher
synced 2026-01-30 03:56:26 +01:00
highlight constraints
This commit is contained in:
parent
f1e2723e59
commit
4abc8ae1d7
2 changed files with 46 additions and 18 deletions
|
|
@ -477,6 +477,10 @@ TCAD.TWO.Constraints.Factory[TCAD.TWO.Constraints.Coincident.prototype.NAME] = f
|
|||
return new TCAD.TWO.Constraints.Coincident(refs(data[0]), refs(data[1]));
|
||||
};
|
||||
|
||||
TCAD.TWO.Constraints.Coincident.prototype.getObjects = function() {
|
||||
return [this.a, this.b];
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
TCAD.TWO.Constraints.Lock = function(p, c) {
|
||||
|
|
@ -501,6 +505,11 @@ TCAD.TWO.Constraints.Factory[TCAD.TWO.Constraints.Lock.prototype.NAME] = functio
|
|||
return new TCAD.TWO.Constraints.Lock(refs(data[0]), data[1]);
|
||||
};
|
||||
|
||||
|
||||
TCAD.TWO.Constraints.Lock.prototype.getObjects = function() {
|
||||
return [this.p];
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
TCAD.TWO.Constraints.Parallel = function(l1, l2) {
|
||||
|
|
@ -525,6 +534,10 @@ TCAD.TWO.Constraints.Factory[TCAD.TWO.Constraints.Parallel.prototype.NAME] = fun
|
|||
return new TCAD.TWO.Constraints.Parallel(refs(data[0]), refs(data[1]));
|
||||
};
|
||||
|
||||
TCAD.TWO.Constraints.Parallel.prototype.getObjects = function() {
|
||||
return [this.l1, this.l2];
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
TCAD.TWO.Constraints.Perpendicular = function(l1, l2) {
|
||||
|
|
@ -549,6 +562,10 @@ TCAD.TWO.Constraints.Factory[TCAD.TWO.Constraints.Perpendicular.prototype.NAME]
|
|||
return new TCAD.TWO.Constraints.Perpendicular(refs(data[0]), refs(data[1]));
|
||||
};
|
||||
|
||||
TCAD.TWO.Constraints.Perpendicular.prototype.getObjects = function() {
|
||||
return [this.l1, this.l2];
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
TCAD.TWO.Constraints.P2LDistance = function(p, l, d) {
|
||||
|
|
@ -574,6 +591,10 @@ TCAD.TWO.Constraints.Factory[TCAD.TWO.Constraints.P2LDistance.prototype.NAME] =
|
|||
return new TCAD.TWO.Constraints.P2LDistance(refs(data[0]), refs(data[1]), data[2]);
|
||||
};
|
||||
|
||||
TCAD.TWO.Constraints.P2LDistance.prototype.getObjects = function() {
|
||||
return [this.p, this.l];
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
TCAD.TWO.Constraints.P2LDistanceV = function(p, l, d) {
|
||||
|
|
@ -628,6 +649,10 @@ TCAD.TWO.Constraints.Factory[TCAD.TWO.Constraints.P2PDistance.prototype.NAME] =
|
|||
return new TCAD.TWO.Constraints.P2PDistance(refs(data[0]), refs(data[1]), data[2]);
|
||||
};
|
||||
|
||||
TCAD.TWO.Constraints.P2PDistance.prototype.getObjects = function() {
|
||||
return [this.p1, this.p2];
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
TCAD.TWO.Constraints.P2PDistanceV = function(p1, p2, d) {
|
||||
|
|
@ -678,6 +703,10 @@ TCAD.TWO.Constraints.Factory[TCAD.TWO.Constraints.Radius.prototype.NAME] = funct
|
|||
return new TCAD.TWO.Constraints.Radius(refs(data[0]), data[1]);
|
||||
};
|
||||
|
||||
TCAD.TWO.Constraints.Radius.prototype.getObjects = function() {
|
||||
return [this.arc];
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
TCAD.TWO.Constraints.RR = function(arc1, arc2) {
|
||||
|
|
@ -699,6 +728,10 @@ TCAD.TWO.Constraints.Factory[TCAD.TWO.Constraints.RR.prototype.NAME] = function(
|
|||
return new TCAD.TWO.Constraints.RR(refs(data[0]), refs(data[1]));
|
||||
};
|
||||
|
||||
TCAD.TWO.Constraints.RR.prototype.getObjects = function() {
|
||||
return [this.arc1, this.arc2];
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
TCAD.TWO.Constraints.Vertical = function(line) {
|
||||
|
|
@ -719,6 +752,10 @@ TCAD.TWO.Constraints.Factory[TCAD.TWO.Constraints.Vertical.prototype.NAME] = fun
|
|||
return new TCAD.TWO.Constraints.Vertical(refs(data[0]));
|
||||
};
|
||||
|
||||
TCAD.TWO.Constraints.Vertical.prototype.getObjects = function() {
|
||||
return [this.line];
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
TCAD.TWO.Constraints.Horizontal = function(line) {
|
||||
|
|
@ -739,6 +776,10 @@ TCAD.TWO.Constraints.Factory[TCAD.TWO.Constraints.Horizontal.prototype.NAME] = f
|
|||
return new TCAD.TWO.Constraints.Horizontal(refs(data[0]));
|
||||
};
|
||||
|
||||
TCAD.TWO.Constraints.Horizontal.prototype.getObjects = function() {
|
||||
return [this.line];
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
TCAD.TWO.Constraints.Tangent = function(arc, line) {
|
||||
|
|
@ -764,4 +805,8 @@ TCAD.TWO.Constraints.Factory[TCAD.TWO.Constraints.Tangent.prototype.NAME] = func
|
|||
return new TCAD.TWO.Constraints.Tangent(refs(data[0]), refs(data[1]));
|
||||
};
|
||||
|
||||
TCAD.TWO.Constraints.Tangent.prototype.getObjects = function() {
|
||||
return [this.arc, this.line];
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
|
|
|||
|
|
@ -244,24 +244,7 @@
|
|||
},
|
||||
|
||||
hover : function(item) {
|
||||
var sdataArr = item.constr.getSolveData();
|
||||
var visited = {};
|
||||
var toSelect = [];
|
||||
|
||||
function collect(obj) {
|
||||
if (obj !== undefined && visited[obj.id] === undefined) {
|
||||
toSelect.push(obj);
|
||||
visited[obj.id] = obj;
|
||||
collect(obj.parent);
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < sdataArr.length; i++) {
|
||||
var params = sdataArr[i][1];
|
||||
for (var j = 0; j < params.length; j++) {
|
||||
collect(params[j].obj);
|
||||
}
|
||||
}
|
||||
app.viewer.select(toSelect, true);
|
||||
app.viewer.select(item.constr.getObjects(), true);
|
||||
app.viewer.refresh();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue