X button on dashboard
This commit is contained in:
@@ -25,6 +25,13 @@
|
||||
</template>
|
||||
|
||||
<elements>
|
||||
<div position="absolute" width="100%" justify_content="space_between">
|
||||
<div />
|
||||
<div padding="6">
|
||||
<Button id="btn_close" sprite_src_builtin="dashboard/close.svg" color="#000000" border="2" border_color="~color_faded" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- left/right separator (menu and rest) -->
|
||||
<div flex_direction="row" gap="8" width="100%" height="100%" padding="4" interactable="0">
|
||||
<!-- LEFT MENU -->
|
||||
|
||||
@@ -100,6 +100,7 @@ pub enum FrontendTask {
|
||||
RecenterPlayspace,
|
||||
PushToast(Translation),
|
||||
PlaySound(SoundType),
|
||||
HideDashboard,
|
||||
}
|
||||
|
||||
impl<T: 'static> Frontend<T> {
|
||||
@@ -333,6 +334,7 @@ impl<T: 'static> Frontend<T> {
|
||||
FrontendTask::RecenterPlayspace => self.action_recenter_playspace(params.data)?,
|
||||
FrontendTask::PushToast(content) => self.toast_manager.push(content),
|
||||
FrontendTask::PlaySound(sound_type) => self.queue_play_sound(sound_type),
|
||||
FrontendTask::HideDashboard => self.action_hide_dashboard(params.data),
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
@@ -357,6 +359,12 @@ impl<T: 'static> Frontend<T> {
|
||||
}
|
||||
|
||||
fn register_widgets(&mut self) -> anyhow::Result<()> {
|
||||
// "X" button
|
||||
self.tasks.handle_button(
|
||||
&self.state.fetch_component_as::<ComponentButton>("btn_close")?,
|
||||
FrontendTask::HideDashboard,
|
||||
);
|
||||
|
||||
// ################################
|
||||
// SIDE BUTTONS
|
||||
// ################################
|
||||
@@ -461,4 +469,8 @@ impl<T: 'static> Frontend<T> {
|
||||
self.interface.recenter_playspace(data)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn action_hide_dashboard(&mut self, data: &mut T) {
|
||||
self.interface.toggle_dashboard(data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user