Fix major bug in layout iteration

This commit is contained in:
Ian Gulliver
2019-07-16 06:13:53 +00:00
parent a40c8ea1fc
commit 87f8d6edd8
3 changed files with 10 additions and 11 deletions

View File

@@ -125,11 +125,15 @@ class Layout {
if (obj.offsetCollides(offset)) {
continue;
}
obj.savePos();
for (let obj of objects) {
obj.savePos();
}
obj.moveBy(offset);
this.setTension(objects);
let testTension = this.getTotalTension(objects);
obj.restorePos();
for (let obj of objects) {
obj.restorePos();
}
if (testTension < baseTension) {
obj.moveBy(offset);
return true;