"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.valueToAngle = exports.angleToValue = void 0;
var valueToAngle = exports.valueToAngle = function valueToAngle(value, min, max, startAngle, endAngle) {
  if (min === max) {
    max++;
  }
  var ratio = (value - min) / (max - min);
  var angle = ratio * (endAngle - startAngle) + startAngle;
  return angle;
};
var angleToValue = exports.angleToValue = function angleToValue(angle, min, max, startAngle, endAngle) {
  if (angle < startAngle) {
    return min;
  } else if (angle > endAngle) {
    return max;
  } else {
    var ratio = (angle - startAngle) / (endAngle - startAngle);
    var value = ratio * (max - min) + min;
    // round to the nearest int value
    return Math.round(value);
  }
};