From 7713015b268d9d40c65201d23e4c1debd5c5fc27 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Wed, 18 Jul 2018 00:49:00 -0600 Subject: [PATCH] Call super before accessing this in icon --- src/ol/style/Icon.js | 71 ++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/src/ol/style/Icon.js b/src/ol/style/Icon.js index 5972bfe5e9..ebacee9523 100644 --- a/src/ol/style/Icon.js +++ b/src/ol/style/Icon.js @@ -61,9 +61,43 @@ class Icon extends ImageStyle { * @api */ constructor(opt_options) { - const options = opt_options || {}; + /** + * @type {number} + */ + const opacity = options.opacity !== undefined ? options.opacity : 1; + + /** + * @type {number} + */ + const rotation = options.rotation !== undefined ? options.rotation : 0; + + /** + * @type {number} + */ + const scale = options.scale !== undefined ? options.scale : 1; + + /** + * @type {boolean} + */ + const rotateWithView = options.rotateWithView !== undefined ? + options.rotateWithView : false; + + /** + * @type {boolean} + */ + const snapToPixel = options.snapToPixel !== undefined ? + options.snapToPixel : true; + + super({ + opacity: opacity, + rotation: rotation, + scale: scale, + snapToPixel: snapToPixel, + rotateWithView: rotateWithView + }); + /** * @private * @type {Array.} @@ -174,41 +208,6 @@ class Icon extends ImageStyle { */ this.size_ = options.size !== undefined ? options.size : null; - /** - * @type {number} - */ - const opacity = options.opacity !== undefined ? options.opacity : 1; - - /** - * @type {boolean} - */ - const rotateWithView = options.rotateWithView !== undefined ? - options.rotateWithView : false; - - /** - * @type {number} - */ - const rotation = options.rotation !== undefined ? options.rotation : 0; - - /** - * @type {number} - */ - const scale = options.scale !== undefined ? options.scale : 1; - - /** - * @type {boolean} - */ - const snapToPixel = options.snapToPixel !== undefined ? - options.snapToPixel : true; - - super({ - opacity: opacity, - rotation: rotation, - scale: scale, - snapToPixel: snapToPixel, - rotateWithView: rotateWithView - }); - } /**