Skip to content

Commit

Permalink
statusbar: improve how colorbar size is calculated and add defensive …
Browse files Browse the repository at this point in the history
…checks
  • Loading branch information
ericmandel committed Oct 9, 2020
1 parent 40b9374 commit b2028f2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions js9-allinone.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion js9.js
Original file line number Diff line number Diff line change
Expand Up @@ -10634,7 +10634,8 @@ JS9.Display.prototype.resize = function(width, height, opts){
if( pinst ){
$(`#${this.id}Statusbar`).css("width", nwidth);
// resize colorbar, if necessary
if( pinst.statusBar.match(/\$colorbar/) &&
if( pinst.statusBar &&
pinst.statusBar.match(/\$colorbar/) &&
opts.resizeStatusbarColorbar !== false ){
pinst.colorwidth = Math.max(pinst.colorwidth + width - owidth,
JS9.Statusbar.COLORWIDTH);
Expand Down
2 changes: 1 addition & 1 deletion js9.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions js9plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -13169,8 +13169,7 @@ JS9.Statusbar.init = function(width, height){
this.height = parseInt(this.divjq.css("height"), 10);
// colorbar width stretches with statusbar
this.colorwidth = parseInt(this.divjq.attr("data-colorbarWidth"), 10) ||
Math.max(this.width - 512 + JS9.Statusbar.COLORWIDTH,
JS9.Statusbar.COLORWIDTH);
JS9.Statusbar.COLORWIDTH + Math.max(this.display.width - 512, 0);
this.colorheight = parseInt(this.divjq.attr("data-colorbarHeight"), 10) ||
JS9.Statusbar.COLORHEIGHT;
// clean plugin container
Expand Down
3 changes: 1 addition & 2 deletions plugins/core/statusbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ JS9.Statusbar.init = function(width, height){
this.height = parseInt(this.divjq.css("height"), 10);
// colorbar width stretches with statusbar
this.colorwidth = parseInt(this.divjq.attr("data-colorbarWidth"), 10) ||
Math.max(this.width - 512 + JS9.Statusbar.COLORWIDTH,
JS9.Statusbar.COLORWIDTH);
JS9.Statusbar.COLORWIDTH + Math.max(this.display.width - 512, 0);
this.colorheight = parseInt(this.divjq.attr("data-colorbarHeight"), 10) ||
JS9.Statusbar.COLORHEIGHT;
// clean plugin container
Expand Down

0 comments on commit b2028f2

Please sign in to comment.