From 752748d491e6a882d2987c4b0a4f49689ba6a521 Mon Sep 17 00:00:00 2001 From: Evert Timberg Date: Tue, 13 Jul 2021 18:18:23 -0400 Subject: [PATCH] Limit Math.asin inputs to the range [-1, 1] --- src/core/core.scale.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/core.scale.js b/src/core/core.scale.js index b6113f794b7..25c4b0ebe2c 100644 --- a/src/core/core.scale.js +++ b/src/core/core.scale.js @@ -593,8 +593,8 @@ export default class Scale extends Element { - tickOpts.padding - getTitleHeight(options.title, me.chart.options.font); maxLabelDiagonal = Math.sqrt(maxLabelWidth * maxLabelWidth + maxLabelHeight * maxLabelHeight); labelRotation = toDegrees(Math.min( - Math.asin(Math.min((labelSizes.highest.height + 6) / tickWidth, 1)), - Math.asin(Math.min(maxHeight / maxLabelDiagonal, 1)) - Math.asin(maxLabelHeight / maxLabelDiagonal) + Math.asin(_limitValue((labelSizes.highest.height + 6) / tickWidth, -1, 1)), + Math.asin(_limitValue(maxHeight / maxLabelDiagonal, -1, 1)) - Math.asin(_limitValue(maxLabelHeight / maxLabelDiagonal, -1, 1)) )); labelRotation = Math.max(minRotation, Math.min(maxRotation, labelRotation)); }