From 7a33fdb99cb3318cee9dfd44a9d5e3230f847822 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Sat, 13 Jan 2024 17:38:24 -0600 Subject: [PATCH] fix(map): correct sort order when selecting lights --- src/lib/map/light/util.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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;