Correctly handle decimal display size (#4009)

Fix the `readUsedSize` regular expression to correctly parse (truncate) pixel decimal values.
This commit is contained in:
Simon Brunel
2017-03-18 11:54:56 +01:00
committed by GitHub
parent 4b421a50bf
commit bd60fa2dfd
2 changed files with 19 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ module.exports = function(Chart) {
*/
function readUsedSize(element, property) {
var value = helpers.getStyle(element, property);
var matches = value && value.match(/(\d+)px/);
var matches = value && value.match(/^(\d+)(\.\d+)?px$/);
return matches? Number(matches[1]) : undefined;
}