nativeview_layout/scene/pointer/
geometry.rs1use nativeview_engine::LayoutRect;
5use nativeview_engine::ext::input::PointerGeometry;
6use nativeview_store::{NodeId, NodeStore};
7
8use crate::scene::LaidOutScene;
9use crate::StoreLayoutEngine;
10
11pub struct SceneGeometry<'a, L: StoreLayoutEngine> {
13 scene: &'a LaidOutScene<L>,
14 store: &'a NodeStore,
15}
16
17impl<L: StoreLayoutEngine> LaidOutScene<L> {
18 #[inline]
20 pub fn pointer_geometry<'a>(&'a self, store: &'a NodeStore) -> SceneGeometry<'a, L> {
21 SceneGeometry { scene: self, store }
22 }
23}
24
25impl<L: StoreLayoutEngine> PointerGeometry for SceneGeometry<'_, L> {
26 #[inline]
27 fn local_rect(&self, node: NodeId) -> Option<LayoutRect> {
28 self.scene.visual_rect_of(self.store, node)
29 }
30}