aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-04-17 11:11:09 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-04-17 11:11:09 +1200
commit7d5b74e554de3328fcd16b2c21fd49dbf2ccba9a (patch)
treeecbb552bf6f48ea62d94bbe9b82181d60d0c9aac
parent123dc07bb506e0b665798a8abbd3911e9e29276c (diff)
downloadtrackermap-server-7d5b74e554de3328fcd16b2c21fd49dbf2ccba9a.tar.gz
trackermap-server-7d5b74e554de3328fcd16b2c21fd49dbf2ccba9a.tar.bz2
trackermap-server-7d5b74e554de3328fcd16b2c21fd49dbf2ccba9a.zip
Update custom openlayers arrow style
-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);
};