feat(segmentation mode): Add create, and export SEG with Brushes (#3632)

This commit is contained in:
Alireza authored and GitHub committed 2023-09-22 10:23:44 -04:00
1 parent 896866e9d0
commit 48bbd6281a
186 files changed
+6801 -2883

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
/**
* Calculates the maximum number of digits required to display a value based on the maximum value and step size.
* @param maxValue - The maximum value to display.
* @param step - The step size between values.
* @returns The maximum number of digits required to display a value.
*/
const getMaxDigits = (maxValue: number, step: number) => {
const integerDigits = maxValue.toString().length;
const decimalDigits = step % 1 === 0 ? 0 : step.toString().split('.')[1].length;
return integerDigits + (decimalDigits ? decimalDigits + 1 : 0);
};
export default getMaxDigits;