Add XRRigidTransform attributes

This commit is contained in:
Manish Goregaokar 2019-03-14 13:11:21 -07:00
parent c775820a79
commit 503ea3d943
2 changed files with 14 additions and 2 deletions

View file

@ -7,7 +7,7 @@
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled",
Constructor(optional DOMPointInit position, optional DOMPointInit orientation)]
interface XRRigidTransform {
// readonly attribute DOMPointReadOnly position;
// readonly attribute DOMPointReadOnly orientation;
readonly attribute DOMPointReadOnly position;
readonly attribute DOMPointReadOnly orientation;
// readonly attribute Float32Array matrix;
};

View file

@ -4,6 +4,7 @@
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
use crate::dom::bindings::codegen::Bindings::XRRigidTransformBinding;
use crate::dom::bindings::codegen::Bindings::XRRigidTransformBinding::XRRigidTransformMethods;
use crate::dom::bindings::error::Fallible;
use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
@ -56,3 +57,14 @@ impl XRRigidTransform {
Ok(XRRigidTransform::new(window, &position, &orientation))
}
}
impl XRRigidTransformMethods for XRRigidTransform {
// https://immersive-web.github.io/webxr/#dom-xrrigidtransform-position
fn Position(&self) -> DomRoot<DOMPointReadOnly> {
DomRoot::from_ref(&self.position)
}
// https://immersive-web.github.io/webxr/#dom-xrrigidtransform-orientation
fn Orientation(&self) -> DomRoot<DOMPointReadOnly> {
DomRoot::from_ref(&self.orientation)
}
}