MCPcopy Create free account
hub / github.com/melonjs/melonJS / roundPeak

Function roundPeak

packages/debug-plugin/src/graphs.js:30–33  ·  view source on GitHub ↗

* Round a peak value up to the nearest multiple of 4, with a floor of 4. * Keeps the graph y-axis stable across small fluctuations. * @param {number} peak

(peak)

Source from the content-addressed store, hash-verified

28 * @param {number} peak
29 */
30function roundPeak(peak) {
31 const rounded = Math.ceil(peak / 4) * 4;
32 return rounded < 4 ? 4 : rounded;
33}
34
35/**
36 * Draw the stacked frame-time sparkline (update + draw).

Callers 2

drawFrameGraphFunction · 0.85
drawMemGraphFunction · 0.85

Calls 1

ceilMethod · 0.65

Tested by

no test coverage detected