Add ol.dom.createCanvasContext2D function
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
goog.provide('ol.source.TileDebug');
|
||||
|
||||
goog.require('goog.dom');
|
||||
goog.require('goog.dom.TagName');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.TileCache');
|
||||
goog.require('ol.TileCoord');
|
||||
goog.require('ol.TileState');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.source.Tile');
|
||||
goog.require('ol.tilegrid.TileGrid');
|
||||
|
||||
@@ -54,14 +53,7 @@ ol.DebugTile_.prototype.getImage = function(opt_context) {
|
||||
} else {
|
||||
|
||||
var tileSize = this.tileSize_;
|
||||
|
||||
var canvas = /** @type {HTMLCanvasElement} */
|
||||
(goog.dom.createElement(goog.dom.TagName.CANVAS));
|
||||
canvas.width = tileSize;
|
||||
canvas.height = tileSize;
|
||||
|
||||
var context = /** @type {CanvasRenderingContext2D} */
|
||||
(canvas.getContext('2d'));
|
||||
var context = ol.dom.createCanvasContext2D(tileSize, tileSize);
|
||||
|
||||
context.strokeStyle = 'black';
|
||||
context.strokeRect(0.5, 0.5, tileSize + 0.5, tileSize + 0.5);
|
||||
@@ -73,8 +65,8 @@ ol.DebugTile_.prototype.getImage = function(opt_context) {
|
||||
context.fillText(
|
||||
this.tileCoord_.toString(), tileSize / 2, tileSize / 2);
|
||||
|
||||
this.canvasByContext_[key] = canvas;
|
||||
return canvas;
|
||||
this.canvasByContext_[key] = context.canvas;
|
||||
return context.canvas;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user