Skip to content

Commit

Permalink
Merge pull request #109 from openworm/geppetto_vfb/feature/218
Browse files Browse the repository at this point in the history
Geppetto vfb/feature/218
  • Loading branch information
tarelli authored Nov 12, 2019
2 parents ff38252 + 6227e16 commit 8a3bbaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions js/components/interface/controlPanel/controlpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1588,19 +1588,22 @@ define(function (require) {
// grab existing input
var gridInput = this.state.data;
var newGridInput = [];

var needsUpdate = false;

// remove unwanted instances from grid input
for (var i = 0; i < instancePaths.length; i++) {
for (var j = 0; j < gridInput.length; j++) {
if (instancePaths[i] != gridInput[j].path) {
newGridInput.push(gridInput[j]);
if (instancePaths[i].indexOf(gridInput[j].path) == -1) {
var index = gridInput.indexOf(gridInput[j].path);
gridInput.splice(index,1);
needsUpdate = true;
}
}
}

// set state to refresh grid
if (gridInput.length != newGridInput.length) {
this.setState({ data: newGridInput });
if (needsUpdate) {
this.setState({ data: gridInput });
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion js/components/widgets/stackViewer/StackViewerComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ define(function (require) {
}

if (Object.keys(this.state.images).length > (this.state.stack.length * this.state.visibleTiles.length)) {
for (let i in Object.keys(this.state.images)) {
for (var i = 0; i < Object.keys(this.state.images).length; i++) {
var id = Object.keys(this.state.images)[i].split(",")[0];
if (id > (this.state.stack.length - 1)) {
delete this.state.images[Object.keys(this.state.images)[i]];
Expand Down

0 comments on commit 8a3bbaf

Please sign in to comment.