mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-19 17:21:50 +03:00
Backed out old coordinate translation modifications, moving pixel density check to rendering code
This commit is contained in:
parent
a23da44b8f
commit
28ddf5a809
20
src/tile.js
20
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
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user