Adding function for Yassin

This commit is contained in:
2023-10-18 19:27:14 +02:00
parent f55c569193
commit 9e08bfc2e4
2 changed files with 11 additions and 1 deletions

View File

@ -1739,6 +1739,16 @@ export class UserAPI {
return sum / values.length;
};
public range = (
inputY: number, yMin: number,
yMax: number, xMin: number,
xMax: number): number => {
const percent = (inputY - yMin) / (yMax - yMin);
const outputX = percent * (xMax - xMin) + xMin;
return outputX;
};
limit = (value: number, min: number, max: number): number => {
/**
* Limits a value between a minimum and a maximum.