Skip to content

Commit

Permalink
#5737 fix model width update method, handle tab switch in plotScope (…
Browse files Browse the repository at this point in the history
…adjust width) (#5747)
  • Loading branch information
jszalek authored and scottdraves committed Jul 27, 2017
1 parent ca6f645 commit 79cf154
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
6 changes: 5 additions & 1 deletion beakerx/js/src/Plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ var PlotView = widgets.DOMWidgetView.extend({
default:
that.initStandardPlot(plotModel);
break;
}
}

that.listenTo(that.model, 'beakerx-tabSelected', function() {
that._currentScope.adjustModelWidth();
});
});
},

Expand Down
8 changes: 4 additions & 4 deletions beakerx/js/src/TableDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ var TableDisplayView = widgets.DOMWidgetView.extend({
that.showWarning(tableModel);
}
that.initTableDisplay(tableModel);
});

this.listenTo(this.model, 'beakerx-tabSelected', function() {
that._currentScope.adjustRedraw();
})
that.listenTo(that.model, 'beakerx-tabSelected', function() {
that._currentScope.adjustRedraw();
});
});
},

update: function() {
Expand Down
1 change: 0 additions & 1 deletion beakerx/js/src/plot/plotConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,6 @@ define([
item.elements.push(ele);
newmodel.data.push(item);
}
console.log("new model",model.rasters);
}
newmodel.yIncludeZero = yAxisSettings.yIncludeZero;
newmodel.yRIncludeZero = yAxisRSettings.yIncludeZero;
Expand Down
8 changes: 6 additions & 2 deletions beakerx/js/src/plot/plotScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -2250,13 +2250,17 @@ define([
self.update();

self.fillCellModelWithPlotMethods();
self.updateModelWidth(self.getPlotWithLegendWidth());
self.adjustModelWidth();
self.emitSizeChange(true);
};

PlotScope.prototype.adjustModelWidth = function() {
this.updateModelWidth(this.getPlotWithLegendWidth());
};

PlotScope.prototype.getPlotWithLegendWidth = function() {
var containerWidth = this.jqlegendcontainer.width();
var plotWidth = this.jqcontainer.width();
var plotWidth = this.plotSize.width;
var legendWidth = this.jqlegendcontainer.find('.plot-legend').width();

return (containerWidth < plotWidth ? containerWidth : plotWidth) - (legendWidth + this.layout.legendMargin + 2);
Expand Down

0 comments on commit 79cf154

Please sign in to comment.