Default to element dimension if image size cannot be determined (vector images)

This commit is contained in:
Niklas von Hertzen
2014-09-08 21:25:21 +03:00
parent 2a020e5a21
commit 44b958beaf
3 changed files with 16 additions and 12 deletions

View File

@ -12,16 +12,18 @@ Renderer.prototype.renderImage = function(container, bounds, borderData, imageCo
paddingBottom = container.cssInt('paddingBottom'),
borders = borderData.borders;
var width = bounds.width - (borders[1].width + borders[3].width + paddingLeft + paddingRight);
var height = bounds.height - (borders[0].width + borders[2].width + paddingTop + paddingBottom);
this.drawImage(
imageContainer,
0,
0,
imageContainer.image.width,
imageContainer.image.height,
imageContainer.image.width || width,
imageContainer.image.height || height,
bounds.left + paddingLeft + borders[3].width,
bounds.top + paddingTop + borders[0].width,
bounds.width - (borders[1].width + borders[3].width + paddingLeft + paddingRight),
bounds.height - (borders[0].width + borders[2].width + paddingTop + paddingBottom)
width,
height
);
};