]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix sizing of tooltip when beforeBody or afterBody is very line 1808/head
authorEvert Timberg <evert.timberg@gmail.com>
Sun, 20 Dec 2015 23:48:44 +0000 (18:48 -0500)
committerEvert Timberg <evert.timberg@gmail.com>
Sun, 20 Dec 2015 23:48:44 +0000 (18:48 -0500)
src/core/core.tooltip.js

index bad1189f3130fabf31f49f545ebe9b75ec1e994f..dfd5d704b0a569e51dd2546295cb4cd973783033 100644 (file)
                                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);