Skip to content

Commit

Permalink
fix a bug with prettify reduction calling undoAdd() in the wrong plac…
Browse files Browse the repository at this point in the history
…e, and another where under certain circumstances extra nodes would be created over the top of others
  • Loading branch information
Daniel Thornton committed Apr 27, 2012
1 parent 0c9960a commit 188d320
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/js/reductions.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ var Reduction = Class.extend({
if (remaining_nodes.length == 2) {
// make the center node one of the existing nodes
center = remaining_nodes.pop();
} else if (resistors.length > 2) {
} else if (remaining_nodes.length > 2) {
// make the center node at the geometric average of the nodes
center = new Node(self.board, 0, 0)
for (i = 0; i < remaining_nodes.length; i++) {
Expand Down Expand Up @@ -419,7 +419,6 @@ var Reduction = Class.extend({

// force-iterate

self.board.undoAdd();
return true;
},
});
Expand Down Expand Up @@ -860,6 +859,7 @@ var PrettifyReduction = Reduction.extend({
reduce: function(self, resistors) {
self._super(resistors);
self.prettify_force_graph();
self.board.undoAdd();
},
});

0 comments on commit 188d320

Please sign in to comment.