Skip to content
Permalink
Browse files

Make viewerSpace [SameObject]

  • Loading branch information...
Manishearth committed Apr 30, 2019
1 parent d4a6a49 commit 0756923e526dca922296a8a27af92234cd2ed544
Showing with 5 additions and 2 deletions.
  1. +1 −1 components/script/dom/webidls/XRSession.webidl
  2. +4 −1 components/script/dom/xrsession.rs
@@ -20,7 +20,7 @@ interface XRSession : EventTarget {
readonly attribute XREnvironmentBlendMode environmentBlendMode;

readonly attribute XRRenderState renderState;
readonly attribute XRSpace viewerSpace;
[SameObject] readonly attribute XRSpace viewerSpace;

// // Methods
Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceOptions options);
@@ -34,6 +34,7 @@ pub struct XRSession {
display: Dom<VRDisplay>,
base_layer: MutNullableDom<XRLayer>,
blend_mode: XREnvironmentBlendMode,
viewer_space: MutNullableDom<XRSpace>,
}

impl XRSession {
@@ -44,6 +45,7 @@ impl XRSession {
base_layer: Default::default(),
// we don't yet support any AR devices
blend_mode: XREnvironmentBlendMode::Opaque,
viewer_space: Default::default(),
}
}

@@ -87,7 +89,8 @@ impl XRSessionMethods for XRSession {

// https://immersive-web.github.io/webxr/#dom-xrsession-viewerspace
fn ViewerSpace(&self) -> DomRoot<XRSpace> {
XRSpace::new_viewerspace(&self.global(), &self)
self.viewer_space
.or_init(|| XRSpace::new_viewerspace(&self.global(), &self))
}

/// https://immersive-web.github.io/webxr/#dom-xrsession-requestanimationframe

0 comments on commit 0756923

Please sign in to comment.
You can’t perform that action at this time.