pub fn snap_to_nearest_corner(
pos: BubblePosition,
window_width: i32,
window_height: i32,
monitor: MonitorBounds,
snap_radius_px: i32,
inset_px: i32,
) -> Option<(BubblePosition, Corner)>Expand description
If the bubble’s top-left is within snap_radius_px of any
monitor’s nearest corner (measured corner-to-corner of the window
vs monitor), snap to that corner’s exact position and return the
snapped (BubblePosition, Corner). Otherwise None.
“Nearest corner of the monitor for this window position” means:
- Top-left → window’s top-left near monitor’s top-left
- Top-right → window’s top-right near monitor’s top-right
- Bottom-* → analogous
So the comparison is between matching corners of the window and
the monitor. Snapping rewrites the window’s top-left so the
matched corners align exactly (with optional inset — see
inset_px).