use nativeview_engine::LayoutRect;
use nativeview_engine::ext::input::PointerGeometry;
use nativeview_store::{NodeId, NodeStore};
use crate::scene::LaidOutScene;
use crate::StoreLayoutEngine;
pub struct SceneGeometry<'a, L: StoreLayoutEngine> {
scene: &'a LaidOutScene<L>,
store: &'a NodeStore,
}
impl<L: StoreLayoutEngine> LaidOutScene<L> {
#[inline]
pub fn pointer_geometry<'a>(&'a self, store: &'a NodeStore) -> SceneGeometry<'a, L> {
SceneGeometry { scene: self, store }
}
}
impl<L: StoreLayoutEngine> PointerGeometry for SceneGeometry<'_, L> {
#[inline]
fn local_rect(&self, node: NodeId) -> Option<LayoutRect> {
self.scene.visual_rect_of(self.store, node)
}
}