From: Evert Timberg Date: Sun, 20 Dec 2015 23:48:44 +0000 (-0500) Subject: Fix sizing of tooltip when beforeBody or afterBody is very line X-Git-Tag: 2.0.0-beta2~13^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1808%2Fhead;p=thirdparty%2FChart.js.git Fix sizing of tooltip when beforeBody or afterBody is very line --- diff --git a/src/core/core.tooltip.js b/src/core/core.tooltip.js index bad1189f3..dfd5d704b 100644 --- a/src/core/core.tooltip.js +++ b/src/core/core.tooltip.js @@ -335,10 +335,18 @@ ctx.font = helpers.fontString(vm.titleFontSize, vm._titleFontStyle, vm._titleFontFamily); tooltipWidth = Math.max(tooltipWidth, ctx.measureText(line).width); }); + helpers.each(vm.beforeBody, function(line) { + ctx.font = helpers.fontString(vm.bodyFontSize, vm._bodyFontStyle, vm._bodyFontFamily); + tooltipWidth = Math.max(tooltipWidth, ctx.measureText(line).width); + }, this); helpers.each(vm.body, function(line) { ctx.font = helpers.fontString(vm.bodyFontSize, vm._bodyFontStyle, vm._bodyFontFamily); tooltipWidth = Math.max(tooltipWidth, ctx.measureText(line).width + (this._options.tooltips.mode !== 'single' ? (vm.bodyFontSize + 2) : 0)); }, this); + helpers.each(vm.afterBody, function(line) { + ctx.font = helpers.fontString(vm.bodyFontSize, vm._bodyFontStyle, vm._bodyFontFamily); + tooltipWidth = Math.max(tooltipWidth, ctx.measureText(line).width); + }, this); helpers.each(vm.footer, function(line) { ctx.font = helpers.fontString(vm.footerFontSize, vm._footerFontStyle, vm._footerFontFamily); tooltipWidth = Math.max(tooltipWidth, ctx.measureText(line).width);