From bafd36b5ec08fb34e0e2d37e62f04c276ad191cf Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Sun, 20 Dec 2015 18:48:44 -0500 Subject: [PATCH] Fix sizing of tooltip when beforeBody or afterBody is very line --- src/core/core.tooltip.js | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.47.2