From: Evert Timberg Date: Wed, 14 Jul 2021 06:14:29 +0000 (-0400) Subject: Limit Math.asin inputs to the range [-1, 1] (#9410) X-Git-Tag: v3.5.0~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df4944786709fb2b3a9038e6676f5491d9243a14;p=thirdparty%2FChart.js.git Limit Math.asin inputs to the range [-1, 1] (#9410) --- diff --git a/src/core/core.scale.js b/src/core/core.scale.js index b6113f794..25c4b0ebe 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)); }