Merge pull request #851 from jtblin/master

Fix #507 - calculate container width and heigh without padding
This commit is contained in:
William Entriken 2015-04-24 10:28:29 -04:00
commit a3d4bc0bfe

View File

@ -826,14 +826,21 @@
});
},
getMaximumWidth = helpers.getMaximumWidth = function(domNode){
var container = domNode.parentNode;
var container = domNode.parentNode,
padding = parseInt(getStyle(container, 'padding-left')) + parseInt(getStyle(container, 'padding-right'));
// TODO = check cross browser stuff with this.
return container.clientWidth;
return container.clientWidth - padding;
},
getMaximumHeight = helpers.getMaximumHeight = function(domNode){
var container = domNode.parentNode;
var container = domNode.parentNode,
padding = parseInt(getStyle(container, 'padding-bottom')) + parseInt(getStyle(container, 'padding-top'));
// TODO = check cross browser stuff with this.
return container.clientHeight;
return container.clientHeight - padding;
},
getStyle = helpers.getStyle = function (el, property) {
return el.currentStyle ?
el.currentStyle[property] :
document.defaultView.getComputedStyle(el, null).getPropertyValue(property);
},
getMaximumSize = helpers.getMaximumSize = helpers.getMaximumWidth, // legacy support
retinaScale = helpers.retinaScale = function(chart){