localize after distance filter

This commit is contained in:
Isse 2023-05-03 16:10:14 +02:00
parent 54a7367cb2
commit 77b7d1a49e

View File

@ -290,13 +290,16 @@ impl<'a> Widget for Subtitles<'a> {
.subtitles
.iter()
.filter_map(|(localization, data)| {
Some((self.localized_strings.get_msg(localization), data.last()?))
Some((localization, data.last()?))
})
.filter(|(_, data)| {
data.position.map_or(true, |pos| {
pos.distance_squared(listener_pos)
< MAX_SUBTITLE_DIST * MAX_SUBTITLE_DIST
})
})
.map(|(localization, data)| {
(self.localized_strings.get_msg(localization), data)
}),
);