MCPcopy Create free account
hub / github.com/FastLED/FastLED / handleGraphicsOptionChange

Function handleGraphicsOptionChange

src/platforms/wasm/compiler/app.ts:275–317  ·  view source on GitHub ↗
(option)

Source from the content-addressed store, hash-verified

273
274// Handle graphics option changes
275function handleGraphicsOptionChange(option) {
276 if (option === 'video-settings') {
277 // Show video settings popup
278 showVideoSettingsPopup();
279 return;
280 }
281
282 if (option === 'toggle-auto-bloom') {
283 // Don't process as regular option - handled by checkbox
284 return;
285 }
286
287 // Determine URL parameter based on selection
288 let gfxParam = '';
289 if (option === 'gfx-simple') {
290 gfxParam = '0'; // Force fast renderer
291 } else if (option === 'gfx-bloom') {
292 gfxParam = '1'; // Force ThreeJS renderer with bloom
293 }
294
295 // Update URL and reload page with new graphics setting
296 const url = new URL(window.location);
297 if (gfxParam) {
298 url.searchParams.set('gfx', gfxParam);
299 } else {
300 url.searchParams.delete('gfx');
301 }
302
303 // Show a brief notification before reloading
304 const toast = document.createElement('div');
305 toast.className = 'toast-notification';
306 toast.textContent = `Switching to ${option.replace('-', ' ')}...`;
307 document.body.appendChild(toast);
308
309 // Force reflow
310 void toast.offsetHeight;
311 toast.classList.add('toast-notification-show');
312
313 // Reload with new graphics setting after brief delay
314 setTimeout(() => {
315 window.location.href = url.toString();
316 }, 500);
317}
318
319// Video Settings Popup Functions - Optimized for encoding speed with MP4 compatibility
320const videoSettingsDefaults = {

Callers 1

app.tsFile · 0.85

Calls 4

showVideoSettingsPopupFunction · 0.85
toStringMethod · 0.80
setMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected