Slight ui improvements

This commit is contained in:
hodasemi 2023-01-18 12:49:04 +01:00
parent af599edb52
commit a75e7bd027
4 changed files with 15 additions and 10 deletions

View file

@ -1,10 +1,12 @@
<?xml-model href="../gui.xsd" type="application/xml" schematypens="http://www.w3.org/2001/XMLSchema"?>
<root>
<grid id="grid" x_dim="9" y_dim="1">
<label id="place" x_slot="0" y_slot="0" text_color="black"></label>
<label id="name"
x_slot="1" y_slot="0" x_size="6" text_color="black"></label>
<label id="time_behind"
x_slot="7" y_slot="0" x_size="2" text_color="black"></label>
<label id="place" x_slot="0" y_slot="0" text_color="black" text_alignment="right"></label>
<label
id="name"
x_slot="1" y_slot="0" x_size="6" text_color="black" text_alignment="left"></label>
<label
id="time_behind"
x_slot="7" y_slot="0" x_size="2" text_color="black" text_alignment="right"></label>
</grid>
</root>

View file

@ -266,8 +266,13 @@ impl LeaderBoardEntry {
pub fn update_time_behind_leader(&mut self, time: f64) -> Result<()> {
self.time_behind_leader = time;
// check if we are leader
if self.time_behind_leader == 0.0 {
self.time_behind_label.set_text("---")
} else {
self.time_behind_label
.set_text(format!("{:.3}", self.time_behind_leader))
.set_text(format!("+{:.3}", self.time_behind_leader))
}
}
pub fn update_time_behind_next(&mut self, time: f64) -> Result<()> {

View file

@ -87,7 +87,7 @@ impl Pedals {
history_image.height(),
)?;
let ortho = ortho(0.0, history_image.width() as f32, 0.0, 1.0, -1.0, 1.0);
let ortho = ortho(0.0, history_image.width() as f32, -0.01, 1.01, -1.0, 1.0);
let descriptor_pool = DescriptorPool::builder()
.set_layout(pipeline.descriptor_layout().clone())

View file

@ -157,8 +157,6 @@ impl Overlay {
));
// create GuiHandler
write_log!(format!("Create Info: \n{:#?}", create_info));
let gui_handler = GuiHandler::new(create_info, &(ctx as Arc<dyn ContextInterface>))?;
write_log!("GuiHandler successfully created");