watch: highlight current set
This commit is contained in:
@@ -64,6 +64,10 @@ impl RenderResources {
|
||||
}
|
||||
}
|
||||
|
||||
pub enum OverlayEventData {
|
||||
SetChanged(Option<usize>),
|
||||
}
|
||||
|
||||
pub trait OverlayBackend: Any {
|
||||
/// Called once, before the first frame is rendered
|
||||
fn init(&mut self, app: &mut AppState) -> anyhow::Result<()>;
|
||||
@@ -82,6 +86,8 @@ pub trait OverlayBackend: Any {
|
||||
/// Must be Some if should_render was Should or Can on the same frame.
|
||||
fn frame_meta(&mut self) -> Option<FrameMeta>;
|
||||
|
||||
fn notify(&mut self, app: &mut AppState, event_data: OverlayEventData) -> anyhow::Result<()>;
|
||||
|
||||
fn on_hover(&mut self, app: &mut AppState, hit: &PointerHit) -> HoverResult;
|
||||
fn on_left(&mut self, app: &mut AppState, pointer: usize);
|
||||
fn on_pointer(&mut self, app: &mut AppState, hit: &PointerHit, pressed: bool);
|
||||
@@ -125,6 +131,10 @@ impl OverlayBackend for DummyBackend {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn notify(&mut self, _: &mut AppState, _event_data: OverlayEventData) -> anyhow::Result<()> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn on_hover(&mut self, _: &mut AppState, _: &PointerHit) -> HoverResult {
|
||||
HoverResult::default()
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ use crate::{
|
||||
},
|
||||
state::AppState,
|
||||
windowing::{
|
||||
backend::OverlayEventData,
|
||||
set::{OverlayWindowSet, SerializedWindowSet},
|
||||
snap_upright,
|
||||
window::OverlayWindowData,
|
||||
@@ -320,6 +321,14 @@ impl<T> OverlayWindowManager<T> {
|
||||
self.restore_set = new_set;
|
||||
}
|
||||
self.current_set = new_set;
|
||||
|
||||
if let Some(watch) = self.mut_by_id(self.watch_id) {
|
||||
watch
|
||||
.config
|
||||
.backend
|
||||
.notify(app, OverlayEventData::SetChanged(new_set))
|
||||
.unwrap(); // TODO: handle this
|
||||
}
|
||||
}
|
||||
|
||||
pub fn show_hide(&mut self, app: &mut AppState) {
|
||||
|
||||
Reference in New Issue
Block a user