pub struct BaseviewTranslator { /* private fields */ }Expand description
Stateful translator from baseview events to truce-gui’s
platform-agnostic InputEvent stream.
Exists because baseview emits logical-point mouse positions on every
platform (macOS via Cocoa points; X11 and Windows via explicit
to_logical) but does not carry a position on ButtonPressed /
ButtonReleased nor synthesize double-clicks.
Emitted InputEvents carry logical coordinates unchanged from
baseview. The rendering backend (e.g. WgpuBackend) handles the
logical→physical conversion at raster time; callers must not
pre-multiply by scale.
Implementations§
Source§impl BaseviewTranslator
impl BaseviewTranslator
Sourcepub fn last_cursor(&self) -> (f32, f32)
pub fn last_cursor(&self) -> (f32, f32)
The last cursor position we saw from a CursorMoved, in logical
points. Useful when a caller needs to query cursor state outside
the event stream (e.g. for its own overlays).
Sourcepub fn translate(&mut self, event: &Event) -> Option<InputEvent>
pub fn translate(&mut self, event: &Event) -> Option<InputEvent>
Convert a baseview event into an InputEvent. Returns None
for events truce-gui doesn’t consume (keyboard, non-L/R/M mouse
buttons, window lifecycle).