Skip to content

Commit

Permalink
#41 don't change aspect ratio of image
Browse files Browse the repository at this point in the history
  • Loading branch information
canbax committed Feb 20, 2020
1 parent 0ffe92c commit 76c6aff
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cytoscape-navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,17 +871,24 @@

var png = that.cy.png({
full: true,
scale: zoom
scale: zoom,
maxHeight: h,
maxWidth: w
});
if( png.indexOf('image/png') < 0 ){
img.removeAttribute( 'src' );
} else {
img.setAttribute( 'src', png );
}

var translate = {
x: (w - zoom*( bb.w ))/2,
y: (h - zoom*( bb.h ))/2
};

$img.style['position'] = 'absolute';
$img.style['width'] = w + 'px';
$img.style['height'] = h + 'px';
$img.style['left'] = translate.x + 'px';
$img.style['top'] = translate.y + 'px';

}

Expand Down

0 comments on commit 76c6aff

Please sign in to comment.