Fix getScaleForEdgeSmoothing with image tile source.

This commit is contained in:
Antoine Vandecreme 2016-04-21 10:31:49 -04:00
parent 3775a877e2
commit f8de9b33b0

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