diff --git a/src/lib/map/light/util.ts b/src/lib/map/light/util.ts index 45e670d..f463f8c 100644 --- a/src/lib/map/light/util.ts +++ b/src/lib/map/light/util.ts @@ -153,7 +153,9 @@ const selectLightsForPosition = ( } // Sort selected lights by distance (closer -> farther) - selectedLights.sort((selectedLight) => -selectedLight.distance); + selectedLights.sort( + (light1: WeightedAreaLight, light2: WeightedAreaLight) => light1.distance - light2.distance, + ); // Distribute weights by falloff let availableWeight = 1.0;