mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Hook XRInputSourceArray into XRSession
This commit is contained in:
parent
868e5cbd62
commit
8ae1c2e0ad
3 changed files with 33 additions and 37 deletions
|
@ -11,6 +11,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::dom::xrinputsource::XRInputSource;
|
||||
use crate::dom::xrsession::XRSession;
|
||||
use dom_struct::dom_struct;
|
||||
use webxr_api::InputId;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct XRInputSourceArray {
|
||||
|
@ -46,6 +47,14 @@ impl XRInputSourceArray {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
pub fn find(&self, id: InputId) -> Option<DomRoot<XRInputSource>> {
|
||||
self.input_sources
|
||||
.borrow()
|
||||
.iter()
|
||||
.find(|x| x.id() == id)
|
||||
.map(|x| DomRoot::from_ref(&**x))
|
||||
}
|
||||
}
|
||||
|
||||
impl XRInputSourceArrayMethods for XRInputSourceArray {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue