mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-07 17:04:58 +01:00
Use prepare-solve idiom
This commit is contained in:
parent
f9cc184d15
commit
1ac5417ae9
3 changed files with 6 additions and 7 deletions
|
|
@ -876,7 +876,11 @@ TCAD.TWO.DragTool.prototype.mousewheel = function(e) {
|
|||
};
|
||||
|
||||
TCAD.TWO.DragTool.prototype.solveRequest = function(rough) {
|
||||
this.solver.solve(rough, 1);
|
||||
this.solver.sync();
|
||||
};
|
||||
|
||||
TCAD.TWO.DragTool.prototype.prepareSolver = function() {
|
||||
var locked;
|
||||
if (this.obj._class === 'TCAD.TWO.EndPoint') {
|
||||
locked = [this.obj._x, this.obj._y];
|
||||
|
|
@ -892,10 +896,4 @@ TCAD.TWO.DragTool.prototype.solveRequest = function(rough) {
|
|||
locked = [];
|
||||
}
|
||||
this.solver = this.viewer.parametricManager.prepare(locked);
|
||||
this.solver.solve(rough, 1);
|
||||
this.solver.sync();
|
||||
};
|
||||
|
||||
TCAD.TWO.DragTool.prototype.prepareSolver = function() {
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ TCAD.constraints.Weighted = function(constr, weight) {
|
|||
|
||||
this.weight = weight;
|
||||
this.params = constr.params;
|
||||
this.constr = constr;
|
||||
|
||||
this.error = function() {
|
||||
return constr.error() * this.weight;
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ TCAD.parametric.prepare = function(constrs, locked, aux, alg) {
|
|||
solveSystem : solve,
|
||||
updateLock : function(values) {
|
||||
for (var i = 0; i < values.length; ++i) {
|
||||
lockingConstrs[i].value = values[i];
|
||||
lockingConstrs[i].constr.value = values[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue