Merge pull request #922 from avandecreme/master

Fix getScaleForEdgeSmoothing with image tile source.
This commit is contained in:
Ian Gilman 2016-04-22 10:15:01 -07:00
commit 1b39167780
2 changed files with 11 additions and 8 deletions

View File

@ -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;
}, },
/** /**