use crate::UiHost;
use fret_core::{AppWindowId, NodeId};
use fret_runtime::DragKindId;
pub fn route<H: UiHost>(app: &H, window: AppWindowId, kind: DragKindId) -> Option<NodeId> {
let routes = app.global::<crate::drag_route::InternalDragRouteService>()?;
routes.route(window, kind)
}
pub fn set_route<H: UiHost>(app: &mut H, window: AppWindowId, kind: DragKindId, node: NodeId) {
app.with_global_mut(
crate::drag_route::InternalDragRouteService::default,
|routes, _app| {
routes.set(window, kind, node);
},
);
}
pub fn remove_route<H: UiHost>(app: &mut H, window: AppWindowId, kind: DragKindId) {
app.with_global_mut(
crate::drag_route::InternalDragRouteService::default,
|routes, _app| {
routes.remove(window, kind);
},
);
}
pub fn clear_window<H: UiHost>(app: &mut H, window: AppWindowId) {
app.with_global_mut(
crate::drag_route::InternalDragRouteService::default,
|routes, _app| {
routes.clear_window(window);
},
);
}