Skip to content

Commit 91f2e5c

Browse files
klauswtoji
authored andcommitted
Barebones sample updates
Add styling for the buttons to make them easier to use, and tweak the DOM Overlay example a bit to match the sample code in the explainer.
1 parent 282157c commit 91f2e5c

File tree

3 files changed

+37
-19
lines changed

3 files changed

+37
-19
lines changed

ar-barebones.html

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,26 @@
2929
<link rel='icon' type='image/png' sizes='96x96' href='favicon-96x96.png'>
3030
<link rel='stylesheet' href='css/common.css'>
3131

32-
<title>Barebones VR</title>
32+
<title>Barebones AR</title>
3333
</head>
3434
<body>
35-
<header>
36-
<details open>
37-
<summary>Barebones WebXR DOM Overlay</summary>
38-
<p>
39-
This sample demonstrates extremely simple use of an "immersive-ar"
40-
session with no library dependencies, with an optional DOM overlay.
41-
It doesn't render anything exciting, just draws a square with a slowly
42-
changing color to prove it's working.
43-
<a class="back" href="./index.html">Back</a>
44-
</p>
45-
<div id="session-info"></div>
46-
<div id="warning-zone"></div>
47-
<button id="xr-button" class="barebones-button" disabled>XR not found</button>
48-
</details>
49-
</header>
35+
<div id="overlay">
36+
<header>
37+
<details open>
38+
<summary>Barebones WebXR DOM Overlay</summary>
39+
<p>
40+
This sample demonstrates extremely simple use of an "immersive-ar"
41+
session with no library dependencies, with an optional DOM overlay.
42+
It doesn't render anything exciting, just draws a rectangle with a
43+
slowly changing color to prove it's working.
44+
<a class="back" href="./index.html">Back</a>
45+
</p>
46+
<div id="session-info"></div>
47+
<div id="warning-zone"></div>
48+
<button id="xr-button" class="barebones-button" disabled>XR not found</button>
49+
</details>
50+
</header>
51+
</div>
5052
<main style='text-align: center;'>
5153
<p>Click 'Enter AR' to see content</p>
5254
</main>
@@ -87,10 +89,9 @@
8789
function onButtonClicked() {
8890
if (!xrSession) {
8991
// Ask for an optional DOM Overlay, see https://immersive-web.github.io/dom-overlays/
90-
// Use BODY as the root element.
9192
navigator.xr.requestSession('immersive-ar', {
9293
optionalFeatures: ['dom-overlay'],
93-
domOverlay: {root: document.body}
94+
domOverlay: {root: document.getElementById('overlay')}
9495
}).then(onSessionStarted, onRequestSessionError);
9596
} else {
9697
xrSession.end();

css/common.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,20 @@ canvas {
6262
margin-right: 0.2em;
6363
margin-left: 0.2em;
6464
}
65+
66+
/* Used for the 'barebones' samples */
67+
.barebones-button {
68+
font-family: "Karla", sans-serif;
69+
border: rgb(80, 168, 252) 2px solid;
70+
border-radius: 2px;
71+
box-sizing: border-box;
72+
background: none;
73+
height: 55px;
74+
min-width: 176px;
75+
display: inline-block;
76+
position: relative;
77+
cursor: pointer;
78+
font-size: 18px;
79+
color: rgb(80, 168, 252);
80+
background-color: rgba(255, 255, 255, 0.7);
81+
}

vr-barebones.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
color to prove it's working.
4343
<a class="back" href="./">Back</a>
4444
</p>
45-
<button id="xr-button" disabled>XR not found</button>
45+
<button id="xr-button" class="barebones-button" disabled>XR not found</button>
4646
</details>
4747
</header>
4848
<main style='text-align: center;'>

0 commit comments

Comments
 (0)