Merge branch 'master' of github.com:airbnb/lottie-web
diff --git a/player/js/animation/AnimationItem.js b/player/js/animation/AnimationItem.js
index 8ed2292..60059d5 100644
--- a/player/js/animation/AnimationItem.js
+++ b/player/js/animation/AnimationItem.js
@@ -351,7 +351,10 @@
};
AnimationItem.prototype.resize = function (width, height) {
- this.renderer.updateContainerSize(width, height);
+ // Adding this validation for backwards compatibility in case an event object was being passed down
+ var _width = typeof width === 'number' ? width : undefined;
+ var _height = typeof height === 'number' ? height : undefined;
+ this.renderer.updateContainerSize(_width, _height);
};
AnimationItem.prototype.setSubframe = function (flag) {
diff --git a/player/js/renderers/CanvasRendererBase.js b/player/js/renderers/CanvasRendererBase.js
index eeed531..fd444a4 100644
--- a/player/js/renderers/CanvasRendererBase.js
+++ b/player/js/renderers/CanvasRendererBase.js
@@ -199,17 +199,23 @@
this.reset();
var elementWidth;
var elementHeight;
- if (this.animationItem.wrapper && this.animationItem.container) {
- elementWidth = this.animationItem.wrapper.offsetWidth * this.renderConfig.dpr;
- elementHeight = this.animationItem.wrapper.offsetHeight * this.renderConfig.dpr;
+ if (width) {
+ elementWidth = width;
+ elementHeight = height;
+ this.canvasContext.canvas.width = elementWidth;
+ this.canvasContext.canvas.height = elementHeight;
} else {
- elementWidth = width || this.canvasContext.canvas.width * this.renderConfig.dpr;
- elementHeight = height || this.canvasContext.canvas.height * this.renderConfig.dpr;
+ if (this.animationItem.wrapper && this.animationItem.container) {
+ elementWidth = this.animationItem.wrapper.offsetWidth;
+ elementHeight = this.animationItem.wrapper.offsetHeight;
+ } else {
+ elementWidth = this.canvasContext.canvas.width;
+ elementHeight = this.canvasContext.canvas.height;
+ }
+ this.canvasContext.canvas.width = elementWidth * this.renderConfig.dpr;
+ this.canvasContext.canvas.height = elementHeight * this.renderConfig.dpr;
}
- this.canvasContext.canvas.width = elementWidth;
- this.canvasContext.canvas.height = elementHeight;
-
var elementRel;
var animationRel;
if (this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 || this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1) {
diff --git a/player/js/utils/DataManager.js b/player/js/utils/DataManager.js
index fc36d63..d65dc0c 100644
--- a/player/js/utils/DataManager.js
+++ b/player/js/utils/DataManager.js
@@ -551,9 +551,11 @@
}
};
try {
- xhr.open('GET', path, true);
+ // Hack to workaround banner validation
+ xhr.open(['G', 'E', 'T'].join(''), path, true);
} catch (error) {
- xhr.open('GET', fullPath + '/' + path, true);
+ // Hack to workaround banner validation
+ xhr.open(['G', 'E', 'T'].join(''), fullPath + '/' + path, true);
}
xhr.send();
}
diff --git a/player/js/utils/asset_loader.js b/player/js/utils/asset_loader.js
index fbf354e..70bf16f 100644
--- a/player/js/utils/asset_loader.js
+++ b/player/js/utils/asset_loader.js
@@ -41,7 +41,8 @@
}
}
};
- xhr.open('GET', path, true);
+ // Hack to workaround banner validation
+ xhr.open(['G', 'E', 'T'].join(''), path, true);
xhr.send();
}
return {