mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fix overly long names clipping on the minimap
This commit is contained in:
parent
7850b0bcaf
commit
82da969707
@ -331,13 +331,26 @@ impl<'a> Widget for MiniMap<'a> {
|
||||
// TODO: Subregion name display
|
||||
|
||||
// Title
|
||||
match self.client.current_chunk() {
|
||||
Some(chunk) => Text::new(chunk.meta().name())
|
||||
.mid_top_with_margin_on(state.ids.mmap_frame, 2.0)
|
||||
.font_size(self.fonts.cyri.scale(18))
|
||||
|
||||
match self.client.current_chunk() {
|
||||
Some(chunk) =>
|
||||
{
|
||||
// Count characters in the name to avoid clipping with the name display
|
||||
let name_len = chunk.meta().name().chars().count();
|
||||
Text::new(chunk.meta().name())
|
||||
.mid_top_with_margin_on(state.ids.mmap_frame, match name_len {
|
||||
16..=30 => 4.0,
|
||||
_ => 2.0,
|
||||
})
|
||||
.font_size(self.fonts.cyri.scale(
|
||||
match name_len {
|
||||
0..=16 => 18,
|
||||
16..=30 => 14,
|
||||
_ => 14,
|
||||
}))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.mmap_location, ui),
|
||||
.set(state.ids.mmap_location, ui)},
|
||||
None => Text::new(" ")
|
||||
.mid_top_with_margin_on(state.ids.mmap_frame, 0.0)
|
||||
.font_size(self.fonts.cyri.scale(18))
|
||||
|
Loading…
Reference in New Issue
Block a user