aboutsummaryrefslogtreecommitdiff
path: root/web/arrowstyle.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/arrowstyle.js')
-rw-r--r--web/arrowstyle.js20
1 files changed, 5 insertions, 15 deletions
diff --git a/web/arrowstyle.js b/web/arrowstyle.js
index ad0ba08ee..a39e04cdf 100644
--- a/web/arrowstyle.js
+++ b/web/arrowstyle.js
@@ -3,6 +3,7 @@ goog.provide('ol.style.Arrow');
goog.require('goog.asserts');
goog.require('ol');
goog.require('ol.color');
+goog.require('ol.dom');
goog.require('ol.has');
goog.require('ol.render.canvas');
goog.require('ol.style.AtlasManager');
@@ -336,18 +337,13 @@ ol.style.Arrow.prototype.render_ = function(atlasManager) {
if (atlasManager === undefined) {
// no atlas manager is used, create a new canvas
- this.canvas_ = /** @type {HTMLCanvasElement} */
- (document.createElement('CANVAS'));
-
- this.canvas_.height = size;
- this.canvas_.width = size;
+ var context = ol.dom.createCanvasContext2D(size, size);
+ this.canvas_ = context.canvas;
// canvas.width and height are rounded to the closest integer
size = this.canvas_.width;
imageSize = size;
- var context = /** @type {CanvasRenderingContext2D} */
- (this.canvas_.getContext('2d'));
this.draw_(renderOptions, context, 0, 0);
this.createHitDetectionCanvas_(renderOptions);
@@ -453,15 +449,9 @@ ol.style.Arrow.prototype.createHitDetectionCanvas_ = function(renderOptions) {
// if no fill style is set, create an extra hit-detection image with a
// default fill style
- this.hitDetectionCanvas_ = /** @type {HTMLCanvasElement} */
- (document.createElement('CANVAS'));
- var canvas = this.hitDetectionCanvas_;
-
- canvas.height = renderOptions.size;
- canvas.width = renderOptions.size;
+ var context = ol.dom.createCanvasContext2D(renderOptions.size, renderOptions.size);
+ this.hitDetectionCanvas_ = context.canvas;
- var context = /** @type {CanvasRenderingContext2D} */
- (canvas.getContext('2d'));
this.drawHitDetectionCanvas_(renderOptions, context, 0, 0);
};