MCPcopy Create free account
hub / github.com/breck7/scroll / clamper

Function clamper

external/.d3.js:14963–14967  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

14961}
14962
14963function clamper(a, b) {
14964 var t;
14965 if (a > b) t = a, a = b, b = t;
14966 return function(x) { return Math.max(a, Math.min(b, x)); };
14967}
14968
14969// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
14970// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].

Callers 1

rescaleFunction · 0.85

Calls 2

maxMethod · 0.80
minMethod · 0.80

Tested by

no test coverage detected