ltk/input/dispatch/
coords.rsuse crate::app::App;
use crate::event_loop::{ AppData, SurfaceFocus };
impl<A: App> AppData<A>
{
pub( crate ) fn surface_offset_for( &self, focus: SurfaceFocus ) -> ( f32, f32 )
{
let SurfaceFocus::Overlay( id ) = focus else { return ( 0.0, 0.0 ); };
let Some( ss ) = self.overlays.get( &id ) else { return ( 0.0, 0.0 ); };
let Some( anchor ) = ss.layer_anchor else { return ( 0.0, 0.0 ); };
let ( sw, sh ) = ( self.main.width as f32, self.main.height as f32 );
let ( w, h ) = ( ss.width as f32, ss.height as f32 );
let x = if anchor.left { 0.0 }
else if anchor.right { sw - w }
else { ( sw - w ) / 2.0 };
let y = if anchor.top { 0.0 }
else if anchor.bottom { sh - h }
else { ( sh - h ) / 2.0 };
( x, y )
}
}