Skip to content

Commit

Permalink
fix(map): correct sort order when selecting lights
Browse files Browse the repository at this point in the history
  • Loading branch information
fallenoak committed Jan 13, 2024
1 parent c8d164c commit 7a33fdb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/map/light/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7a33fdb

Please sign in to comment.