MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / clampCssByte

Function clampCssByte

libs/echarts/echarts-en.simple.js:3782–3785  ·  view source on GitHub ↗
(i)

Source from the content-addressed store, hash-verified

3780};
3781
3782function clampCssByte(i) { // Clamp to integer 0 .. 255.
3783 i = Math.round(i); // Seems to be what Chrome does (vs truncation).
3784 return i < 0 ? 0 : i > 255 ? 255 : i;
3785}
3786
3787function clampCssFloat(f) { // Clamp to float 0.0 .. 1.0.
3788 return f < 0 ? 0 : f > 1 ? 1 : f;

Callers 2

parseCssIntFunction · 0.70
hsla2rgbaFunction · 0.70

Calls 1

roundMethod · 0.80

Tested by

no test coverage detected