MCPcopy Create free account
hub / github.com/NianBroken/Firework_Simulator / handleResize

Function handleResize

js/script.js:1174–1188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1172
1173// Account for window resize and custom scale changes.
1174function handleResize() {
1175 const w = window.innerWidth;
1176 const h = window.innerHeight;
1177 // Try to adopt screen size, heeding maximum sizes specified
1178 const containerW = Math.min(w, MAX_WIDTH);
1179 // On small screens, use full device height
1180 const containerH = w <= 420 ? h : Math.min(h, MAX_HEIGHT);
1181 appNodes.stageContainer.style.width = containerW + "px";
1182 appNodes.stageContainer.style.height = containerH + "px";
1183 stages.forEach((stage) => stage.resize(containerW, containerH));
1184 // Account for scale
1185 const scaleFactor = scaleFactorSelector();
1186 stageW = containerW / scaleFactor;
1187 stageH = containerH / scaleFactor;
1188}
1189
1190// Compute initial dimensions
1191handleResize();

Callers 1

script.jsFile · 0.85

Calls 1

scaleFactorSelectorFunction · 0.85

Tested by

no test coverage detected