"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.angleToValue = exports.valueToAngle = void 0;

var valueToAngle = function valueToAngle(value, min, max, startAngle, endAngle) {
  var ratio = (value - min) / (max - min);
  var angle = ratio * (endAngle - startAngle) + startAngle;
  return angle;
};

exports.valueToAngle = valueToAngle;

var 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);
  }
};

exports.angleToValue = angleToValue;