Skip to content

Commit

Permalink
fix display offsets for small images
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmandel committed Oct 21, 2019
1 parent fd340e6 commit 0b60b72
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
18 changes: 9 additions & 9 deletions js9-allinone.js

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

7 changes: 5 additions & 2 deletions js9.js
Original file line number Diff line number Diff line change
Expand Up @@ -2966,15 +2966,18 @@ JS9.Image.prototype.calcDisplayOffsets = function(dowcs){
let wcsim, wcssect, npos, oval;
const sect = this.rgb.sect;
// calculate offsets
this.ix = Math.floor((this.display.canvas.width - this.rgb.img.width)/2);
this.iy = Math.floor((this.display.canvas.height - this.rgb.img.height)/2);
this.ix = (this.display.canvas.width - this.rgb.img.width) / 2;
this.iy = (this.display.canvas.height - this.rgb.img.height) / 2;
// adjust when section is not centered on display
if( JS9.notNull(sect.ix) ){
this.ix -= sect.ix / 2;
}
if( JS9.notNull(sect.iy) ){
this.iy += sect.iy / 2;
}
// ensure integer offsets
this.ix = Math.floor(this.ix);
this.iy = Math.floor(this.iy);
// do wcs alignment, if necessary
if( dowcs && this.wcsAlign() ){
// calc offsets so as to align with the wcs image
Expand Down
Loading

0 comments on commit 0b60b72

Please sign in to comment.