mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-19 17:21:50 +03:00
Merge pull request #922 from avandecreme/master
Fix getScaleForEdgeSmoothing with image tile source.
This commit is contained in:
commit
1b39167780
11
src/tile.js
11
src/tile.js
@ -336,15 +336,18 @@ $.Tile.prototype = {
|
|||||||
* @return {Float}
|
* @return {Float}
|
||||||
*/
|
*/
|
||||||
getScaleForEdgeSmoothing: function() {
|
getScaleForEdgeSmoothing: function() {
|
||||||
if (!this.cacheImageRecord) {
|
var context;
|
||||||
|
if (this.cacheImageRecord) {
|
||||||
|
context = this.cacheImageRecord.getRenderedContext();
|
||||||
|
} else if (this.context2D) {
|
||||||
|
context = this.context2D;
|
||||||
|
} else {
|
||||||
$.console.warn(
|
$.console.warn(
|
||||||
'[Tile.drawCanvas] attempting to get tile scale %s when tile\'s not cached',
|
'[Tile.drawCanvas] attempting to get tile scale %s when tile\'s not cached',
|
||||||
this.toString());
|
this.toString());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
return context.canvas.width / (this.size.x * $.pixelDensityRatio);
|
||||||
var rendered = this.cacheImageRecord.getRenderedContext();
|
|
||||||
return rendered.canvas.width / this.size.times($.pixelDensityRatio).x;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,7 +190,7 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
|
|||||||
this.aspectRatio = ( options.width && options.height ) ?
|
this.aspectRatio = ( options.width && options.height ) ?
|
||||||
( options.width / options.height ) : 1;
|
( options.width / options.height ) : 1;
|
||||||
this.dimensions = new $.Point( options.width, options.height );
|
this.dimensions = new $.Point( options.width, options.height );
|
||||||
|
|
||||||
if ( this.tileSize ){
|
if ( this.tileSize ){
|
||||||
this._tileWidth = this._tileHeight = this.tileSize;
|
this._tileWidth = this._tileHeight = this.tileSize;
|
||||||
delete this.tileSize;
|
delete this.tileSize;
|
||||||
@ -212,7 +212,7 @@ $.TileSource = function( width, height, tileSize, tileOverlap, minLevel, maxLeve
|
|||||||
this._tileHeight = 0;
|
this._tileHeight = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tileOverlap = options.tileOverlap ? options.tileOverlap : 0;
|
this.tileOverlap = options.tileOverlap ? options.tileOverlap : 0;
|
||||||
this.minLevel = options.minLevel ? options.minLevel : 0;
|
this.minLevel = options.minLevel ? options.minLevel : 0;
|
||||||
this.maxLevel = ( undefined !== options.maxLevel && null !== options.maxLevel ) ?
|
this.maxLevel = ( undefined !== options.maxLevel && null !== options.maxLevel ) ?
|
||||||
@ -240,7 +240,7 @@ $.TileSource.prototype = {
|
|||||||
);
|
);
|
||||||
return this._tileWidth;
|
return this._tileWidth;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the tileWidth for a given level.
|
* Return the tileWidth for a given level.
|
||||||
* Subclasses should override this if tileWidth can be different at different levels
|
* Subclasses should override this if tileWidth can be different at different levels
|
||||||
@ -331,7 +331,7 @@ $.TileSource.prototype = {
|
|||||||
Math.floor( rect.x / this.getTileWidth(i) ),
|
Math.floor( rect.x / this.getTileWidth(i) ),
|
||||||
Math.floor( rect.y / this.getTileHeight(i) )
|
Math.floor( rect.y / this.getTileHeight(i) )
|
||||||
);
|
);
|
||||||
|
|
||||||
if( tiles.x + 1 >= tilesPerSide.x && tiles.y + 1 >= tilesPerSide.y ){
|
if( tiles.x + 1 >= tilesPerSide.x && tiles.y + 1 >= tilesPerSide.y ){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user