diff --git a/src/tile.js b/src/tile.js index 30082315..e2f34941 100644 --- a/src/tile.js +++ b/src/tile.js @@ -268,18 +268,18 @@ $.Tile.prototype = /** @lends OpenSeadragon.Tile.prototype */{ //clearing only the inside of the rectangle occupied //by the png prevents edge flikering context.clearRect( - position.x+1, - position.y+1, - size.x-2, - size.y-2 + (position.x * $.pixelDensityRatio)+1, + (position.y * $.pixelDensityRatio)+1, + (size.x * $.pixelDensityRatio)-2, + (size.y * $.pixelDensityRatio)-2 ); } if(!rendered){ canvas = document.createElement( 'canvas' ); - canvas.width = this.image.width; - canvas.height = this.image.height; + canvas.width = this.image.width * $.pixelDensityRatio; + canvas.height = this.image.height * $.pixelDensityRatio; rendered = canvas.getContext('2d'); rendered.drawImage( this.image, 0, 0 ); this.cacheImageRecord.setRenderedContext(rendered); @@ -297,10 +297,10 @@ $.Tile.prototype = /** @lends OpenSeadragon.Tile.prototype */{ 0, rendered.canvas.width, rendered.canvas.height, - position.x, - position.y, - size.x, - size.y + position.x * $.pixelDensityRatio, + position.y * $.pixelDensityRatio, + size.x * $.pixelDensityRatio, + size.y * $.pixelDensityRatio ); }, diff --git a/src/tiledimage.js b/src/tiledimage.js index 34c8cd3b..2f3378d2 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -262,7 +262,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag // private _viewportToImageDelta: function( viewerX, viewerY, current ) { - var scale = (current ? this._scaleSpring.current.value : this._scaleSpring.target.value) / $.pixelDensityRatio; + var scale = (current ? this._scaleSpring.current.value : this._scaleSpring.target.value); return new $.Point(viewerX * (this.source.dimensions.x / scale), viewerY * ((this.source.dimensions.y * this.contentAspectX) / scale)); }, @@ -294,7 +294,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag // private _imageToViewportDelta: function( imageX, imageY, current ) { - var scale = (current ? this._scaleSpring.current.value : this._scaleSpring.target.value) / $.pixelDensityRatio; + var scale = (current ? this._scaleSpring.current.value : this._scaleSpring.target.value); return new $.Point((imageX / this.source.dimensions.x) * scale, (imageY / this.source.dimensions.y / this.contentAspectX) * scale); }, @@ -562,6 +562,7 @@ function updateViewport( tiledImage ) { var viewportBR = viewportBounds.getBottomRight(); //Don't draw if completely outside of the viewport + $.console.log(viewportTL.x); if ( !tiledImage.wrapHorizontal && (viewportBR.x < 0 || viewportTL.x > tiledImage._worldWidthCurrent ) ) { return; } diff --git a/src/viewport.js b/src/viewport.js index d1f52223..44654f7e 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -897,8 +897,6 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{ deltaPixelsFromPoints: function( deltaPoints, current ) { return deltaPoints.times( this._containerInnerSize.x * this.getZoom( current ) - ).times( - $.pixelDensityRatio ); }, @@ -910,8 +908,6 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{ deltaPointsFromPixels: function( deltaPixels, current ) { return deltaPixels.divide( this._containerInnerSize.x * this.getZoom( current ) - ).divide( - $.pixelDensityRatio ); }, @@ -932,8 +928,6 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{ this._containerInnerSize.x / bounds.width ).plus( new $.Point(this._margins.left, this._margins.top) - ).times( - $.pixelDensityRatio ); }, @@ -944,9 +938,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{ */ pointFromPixel: function( pixel, current ) { var bounds = this.getBounds( current ); - return pixel.divide( - $.pixelDensityRatio - ).minus( + return pixel.minus( new $.Point(this._margins.left, this._margins.top) ).divide( this._containerInnerSize.x / bounds.width