Merge pull request #5036 from ahocevar/icon-imgsize

Use imgSize when provided
This commit is contained in:
Andreas Hocevar
2016-03-15 18:56:27 +01:00
3 changed files with 22 additions and 4 deletions

View File

@@ -106,9 +106,6 @@ ol.style.Icon = function(opt_options) {
goog.asserts.assert(!(src !== undefined && image),
'image and src can not provided at the same time');
goog.asserts.assert(
src === undefined || (src !== undefined && !imgSize),
'imgSize should not be set when src is provided');
goog.asserts.assert(
!image || (image && imgSize),
'imgSize must be set when image is provided');
@@ -513,6 +510,10 @@ ol.style.IconImage_.prototype.handleImageError_ = function() {
*/
ol.style.IconImage_.prototype.handleImageLoad_ = function() {
this.imageState_ = ol.style.ImageState.LOADED;
if (this.size_) {
this.image_.width = this.size_[0];
this.image_.height = this.size_[1];
}
this.size_ = [this.image_.width, this.image_.height];
this.unlistenImage_();
this.determineTainting_();