mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Add XRHitTestResult
This commit is contained in:
parent
341d36a826
commit
c7b91523d0
4 changed files with 52 additions and 1 deletions
|
@ -554,7 +554,8 @@ unsafe_no_jsmanaged_fields!(
|
||||||
webxr_api::Frame,
|
webxr_api::Frame,
|
||||||
webxr_api::InputSource,
|
webxr_api::InputSource,
|
||||||
webxr_api::InputId,
|
webxr_api::InputId,
|
||||||
webxr_api::HitTestId
|
webxr_api::HitTestId,
|
||||||
|
webxr_api::HitTestResult
|
||||||
);
|
);
|
||||||
unsafe_no_jsmanaged_fields!(ScriptToConstellationChan);
|
unsafe_no_jsmanaged_fields!(ScriptToConstellationChan);
|
||||||
unsafe_no_jsmanaged_fields!(InteractiveMetrics);
|
unsafe_no_jsmanaged_fields!(InteractiveMetrics);
|
||||||
|
|
|
@ -572,6 +572,7 @@ pub mod xmlhttprequesteventtarget;
|
||||||
pub mod xmlhttprequestupload;
|
pub mod xmlhttprequestupload;
|
||||||
pub mod xmlserializer;
|
pub mod xmlserializer;
|
||||||
pub mod xrframe;
|
pub mod xrframe;
|
||||||
|
pub mod xrhittestresult;
|
||||||
pub mod xrhittestsource;
|
pub mod xrhittestsource;
|
||||||
pub mod xrinputsource;
|
pub mod xrinputsource;
|
||||||
pub mod xrinputsourcearray;
|
pub mod xrinputsourcearray;
|
||||||
|
|
10
components/script/dom/webidls/XRHitTestResult.webidl
Normal file
10
components/script/dom/webidls/XRHitTestResult.webidl
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// https://immersive-web.github.io/hit-test/#xrhittestresult-interface
|
||||||
|
|
||||||
|
[SecureContext, Exposed=Window]
|
||||||
|
interface XRHitTestResult {
|
||||||
|
// XRPose? getPose(XRSpace baseSpace);
|
||||||
|
};
|
39
components/script/dom/xrhittestresult.rs
Normal file
39
components/script/dom/xrhittestresult.rs
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||||
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
|
use crate::dom::globalscope::GlobalScope;
|
||||||
|
use crate::dom::xrframe::XRFrame;
|
||||||
|
use dom_struct::dom_struct;
|
||||||
|
use webxr_api::HitTestResult;
|
||||||
|
|
||||||
|
#[dom_struct]
|
||||||
|
pub struct XRHitTestResult {
|
||||||
|
reflector_: Reflector,
|
||||||
|
#[ignore_malloc_size_of = "defined in webxr"]
|
||||||
|
result: HitTestResult,
|
||||||
|
frame: Dom<XRFrame>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl XRHitTestResult {
|
||||||
|
fn new_inherited(result: HitTestResult, frame: &XRFrame) -> XRHitTestResult {
|
||||||
|
XRHitTestResult {
|
||||||
|
reflector_: Reflector::new(),
|
||||||
|
result,
|
||||||
|
frame: Dom::from_ref(frame),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new(
|
||||||
|
global: &GlobalScope,
|
||||||
|
result: HitTestResult,
|
||||||
|
frame: &XRFrame,
|
||||||
|
) -> DomRoot<XRHitTestResult> {
|
||||||
|
reflect_dom_object(
|
||||||
|
Box::new(XRHitTestResult::new_inherited(result, frame)),
|
||||||
|
global,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue