Move UI logic to Stimulus: toolbar only

This commit is contained in:
2026-04-21 15:30:35 +02:00
parent d37e72390d
commit 26bea5daae
9 changed files with 288 additions and 166 deletions

View File

@@ -0,0 +1,28 @@
import { Controller } from "@hotwired/stimulus"
import AppState from "../state.js";
export default class extends Controller {
static targets = ['ao', 'shadows'];
connect() {
console.log('#settings controller connected');
this.aoTarget.checked = AppState.ambientOcclusion;
this.shadowsTarget.checked = AppState.shadows;
}
/**
* Toggle Ambient Occlusion
* @param {Event} event
*/
toggleAO(event) {
ATON.FX.togglePass(ATON.FX.PASS_AO, event.target.checked);
AppState.ambientOcclusion = event.target.checked;
}
/**
* Toggle shadows
* @param {Event} event
*/
toggleShadows(event) {
ATON.toggleShadows(event.target.checked);
AppState.shadows = event.target.checked;
}
}