Skip to content

Commit

Permalink
Limit Math.asin inputs to the range [-1, 1] (#9410)
Browse files Browse the repository at this point in the history
  • Loading branch information
etimberg committed Jul 14, 2021
1 parent 58999ea commit df49447
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/core.scale.js
Expand Up @@ -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));
}
Expand Down

0 comments on commit df49447

Please sign in to comment.