mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Make poses nullable
This commit is contained in:
parent
0780fb0693
commit
1062249fd8
3 changed files with 14 additions and 5 deletions
|
@ -57,9 +57,9 @@ impl XRSpace {
|
|||
/// The reference origin used is common between all
|
||||
/// get_pose calls for spaces from the same device, so this can be used to compare
|
||||
/// with other spaces
|
||||
pub fn get_pose(&self, base_pose: &Frame) -> ApiPose {
|
||||
pub fn get_pose(&self, base_pose: &Frame) -> Option<ApiPose> {
|
||||
if let Some(reference) = self.downcast::<XRReferenceSpace>() {
|
||||
reference.get_pose(base_pose)
|
||||
Some(reference.get_pose(base_pose))
|
||||
} else if let Some(source) = self.input_source.get() {
|
||||
// XXXManishearth we should be able to request frame information
|
||||
// for inputs when necessary instead of always loading it
|
||||
|
@ -72,7 +72,7 @@ impl XRSpace {
|
|||
.iter()
|
||||
.find(|i| i.id == id)
|
||||
.expect("no input found");
|
||||
cast_transform(frame.target_ray_origin)
|
||||
Some(cast_transform(frame.target_ray_origin))
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue