Sha256: 38d4d6d6030e561928b123a855d03d593a8944ec5c7ad9bc041a87a7cd3c480c

Contents?: true

Size: 367 Bytes

Versions: 5

Compression:

Stored size: 367 Bytes

Contents

// Scales a number `src` from range `[minSrc,maxSrc]` to `[minTgt,maxTgt]`.
// Ref. http://stackoverflow.com/a/5295202
// eslint-disable-next-line no-unused-vars
function scaleNumber(minTgt, maxTgt, minSrc, maxSrc, src) {
  src = parseFloat(src);
  if (maxSrc === minSrc) return maxTgt;
  return (((maxTgt - minTgt) * (src - minSrc)) / (maxSrc - minSrc)) + minTgt;
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lcms-engine-0.1.4 app/assets/javascripts/lcms/engine/components/utils/scalenumber.js.jsx
lcms-engine-0.1.3 app/assets/javascripts/lcms/engine/components/utils/scalenumber.js.jsx
lcms-engine-0.2.0 app/assets/javascripts/lcms/engine/components/utils/scalenumber.js.jsx
lcms-engine-0.1.2 app/assets/javascripts/lcms/engine/components/utils/scalenumber.js.jsx
lcms-engine-0.1.0 app/assets/javascripts/lcms/engine/components/utils/scalenumber.js.jsx