From d6ba90638670e2f0b4cd39fd9afd4d2104fe22b0 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 31 Mar 2026 20:13:57 +0200 Subject: [PATCH] Add functions to apply changes for Point Light and Spot Light --- src/app/App.tsx | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/app/App.tsx b/src/app/App.tsx index c12f6d05..fb9b1751 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -1358,6 +1358,50 @@ export function App({ store, initialStatusMessage }: AppProps) { } }; + const applyPointLightChange = () => { + if (selectedPointLight === null) { + setStatusMessage("Select a Point Light before editing it."); + return; + } + + try { + const nextEntity = createPointLightEntity({ + id: selectedPointLight.id, + position: snapVec3ToGrid(readVec3Draft(entityPositionDraft, "Point Light position"), DEFAULT_GRID_SIZE), + colorHex: pointLightColorDraft, + intensity: readNonNegativeNumberDraft(pointLightIntensityDraft, "Point Light intensity"), + distance: readPositiveNumberDraft(pointLightDistanceDraft, "Point Light distance") + }); + + commitEntityChange(selectedPointLight, nextEntity, "Updated Point Light."); + } catch (error) { + setStatusMessage(getErrorMessage(error)); + } + }; + + const applySpotLightChange = () => { + if (selectedSpotLight === null) { + setStatusMessage("Select a Spot Light before editing it."); + return; + } + + try { + const nextEntity = createSpotLightEntity({ + id: selectedSpotLight.id, + position: snapVec3ToGrid(readVec3Draft(entityPositionDraft, "Spot Light position"), DEFAULT_GRID_SIZE), + direction: readVec3Draft(spotLightDirectionDraft, "Spot Light direction"), + colorHex: spotLightColorDraft, + intensity: readNonNegativeNumberDraft(spotLightIntensityDraft, "Spot Light intensity"), + distance: readPositiveNumberDraft(spotLightDistanceDraft, "Spot Light distance"), + angleDegrees: readPositiveNumberDraft(spotLightAngleDraft, "Spot Light angle") + }); + + commitEntityChange(selectedSpotLight, nextEntity, "Updated Spot Light."); + } catch (error) { + setStatusMessage(getErrorMessage(error)); + } + }; + const applySoundEmitterChange = () => { if (selectedSoundEmitter === null) { setStatusMessage("Select a Sound Emitter before editing it.");