Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: hanbollar <github@hannahbollar.com>
  • Loading branch information
hanbollar committed May 15, 2024
1 parent 8290272 commit 7c65e5a
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dist/mr.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion samples/examples/audio.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<body >


<mr-app >
<mr-app>
<mr-panel class="layout" data-comp-anchor="type: fixed;">

<mr-div id="navbar">
Expand Down
2 changes: 1 addition & 1 deletion samples/examples/camera.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body >
<mr-app orbital="mode:true; targetPos:0.5 0.25 0;" camera="mode: perspective; startPos:1 1 1;">
<mr-app data-orbital="mode:true; targetPos:0.5 0.25 0;" data-camera="mode: perspective; startPos:1 1 1;">
<mr-panel id="panel" class="layout" data-comp-anchor="type: fixed;">
<mr-div id="navbar">
<mr-a href="https://mrjs.io" class="mrjs">
Expand Down
2 changes: 1 addition & 1 deletion samples/examples/debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body >
<mr-app debug="true" stats="true" preserve-drawing-buffer="true">
<mr-app data-debug="true" data-stats="true" data-preserveDrawingBuffer="true">
<mr-panel class="layout">
<mr-div id="navbar">
<mr-a href="https://mrjs.io" class="mrjs">
Expand Down
2 changes: 1 addition & 1 deletion samples/examples/models.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body >
<mr-app> <!-- debug="true"> !--stats="true">-->
<mr-app>
<mr-panel id="panel" class="layout" data-comp-anchor="type: fixed;">
<mr-div id="navbar">
<mr-a href="https://mrjs.io" class="mrjs">
Expand Down
2 changes: 1 addition & 1 deletion samples/examples/physics.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</style>
</head>
<body >
<mr-app orbital="true" debug="true">
<mr-app data-orbital="mode:true" data-debug="true">
<mr-model id="baseline" src="../examples-assets/models/tiledesert001.glb"
style="scale: 0.1;"
data-comp-animation="clip: 1; action: play;"
Expand Down
2 changes: 1 addition & 1 deletion samples/examples/skybox.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body >
<mr-app occlusion="spotlight">
<mr-app data-occlusion="spotlight" data-orbital="mode:true">
<mr-panel id="panel" class="layout" data-comp-anchor="type: fixed;">
<mr-div id="navbar">
<mr-a href="https://mrjs.io" class="mrjs">
Expand Down
2 changes: 1 addition & 1 deletion samples/examples/text.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body >
<mr-app> <!--debug="true" -->
<mr-app>
<mr-panel id="panel" class="layout" data-comp-anchor="type: fixed;">
<mr-div id="navbar">
<mr-a href="https://mrjs.io" class="mrjs">
Expand Down
18 changes: 9 additions & 9 deletions src/core/MRApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class MRApp extends MRElement {
document.addEventListener('engine-started', (event) => {
this.user = new MRUser(this.camera, this.scene);

if (this.getAttribute('occlusion') == 'spotlight') {
if (this.dataset.occlusion == 'spotlight') {
this.scene.add(this.user.initSpotlight());
}

Expand Down Expand Up @@ -234,7 +234,7 @@ export class MRApp extends MRElement {
init() {
window.addEventListener('resize', this.onWindowResize);

this.debug = this.getAttribute('debug') ?? false;
this.debug = this.dataset.debug ?? false;

/* --- Renderer Setup --- */

Expand All @@ -248,7 +248,7 @@ export class MRApp extends MRElement {
// References:
// https://stackoverflow.com/questions/15558418/how-do-you-save-an-image-from-a-three-js-canvas
// https://stackoverflow.com/questions/30628064/how-to-toggle-preservedrawingbuffer-in-three-js
preserveDrawingBuffer: this.getAttribute('preserve-drawing-buffer') ?? false,
preserveDrawingBuffer: this.dataset.preserveDrawingBuffer ?? false,
});
this.renderer.setPixelRatio(window.devicePixelRatio);
this.renderer.setSize(this.appWidth, this.appHeight);
Expand All @@ -268,7 +268,7 @@ export class MRApp extends MRElement {

this.initCamera();

const layersString = this.getAttribute('layers');
const layersString = this.dataset.layers;
if (layersString) {
this.layers = mrjsUtils.string.stringToVector(layersString);

Expand All @@ -277,7 +277,7 @@ export class MRApp extends MRElement {
}
}

const orbitalOptionsString = this.getAttribute('orbital');
const orbitalOptionsString = this.dataset.orbital;
let orbitalOptions = {};
if (orbitalOptionsString) {
orbitalOptions = mrjsUtils.string.stringToJson(orbitalOptionsString);
Expand Down Expand Up @@ -320,14 +320,14 @@ export class MRApp extends MRElement {

/* --- Lighting Setup --- */

if (this.getAttribute('lighting') ?? false) {
this.lighting = mrjsUtils.string.stringToJson(this.lighting);
if (this.dataset.lighting ?? false) {
this.lighting = mrjsUtils.string.stringToJson(this.dataset.lighting);
}
this.initLights(this.lighting);

/* --- Stats Setup --- */

if (this.getAttribute('stats') ?? false) {
if (this.dataset.stats ?? false) {
// Old version of stats using the Stats.js visual
// setup. Leaving to allow for top left quick visual of stats.
// Is /not/ performant in headset. Documentation notes this.
Expand Down Expand Up @@ -388,7 +388,7 @@ export class MRApp extends MRElement {
* @description Initializes the user information for the MRApp including appropriate HMD direction and camera information and the default scene anchor location.
*/
initCamera = () => {
const cameraOptionsString = this.getAttribute('camera') ?? '';
const cameraOptionsString = this.dataset.camera ?? '';
if (cameraOptionsString) {
Object.assign(this.cameraOptions, mrjsUtils.string.stringToJson(this.cameraOptionString) ?? {});
}
Expand Down

0 comments on commit 7c65e5a

Please sign in to comment.