Call super before accessing this in icon

This commit is contained in:
Tim Schaub
2018-07-18 00:49:00 -06:00
parent fe8fcfbc7e
commit 7713015b26

View File

@@ -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.<number>}
@@ -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
});
}
/**