Function logical_point_to_panel_local

Source
pub fn logical_point_to_panel_local(
    point: Point,
    logical_size: Size,
    layer_size: Extent2Df,
) -> Vec3
Expand description

Maps a top-left-origin logical UI point into panel-local metres.

Logical width and height are clamped to at least one to avoid division by zero. Points are not clamped, so coordinates beyond the UI map beyond the panel. Local Z is always zero.

ยงExamples

use ailloli_ui_core::{Point, Size};
use ailloli_ui_openxr::openxr_runtime::logical_point_to_panel_local;
let local = logical_point_to_panel_local(Point::new(50.0, 25.0), Size::new(100.0, 50.0), openxr::Extent2Df { width: 2.0, height: 1.0 });
assert_eq!((local.x, local.y, local.z), (0.0, 0.0, 0.0));