Skip to content

Commit

Permalink
Temp fix for hackathon (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelthatsit authored Feb 10, 2024
1 parent eaabe7a commit 270bc0d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mrjs",
"version": "0.5.0",
"version": "0.5.1",
"type": "module",
"description": "an MR first webXR framework",
"main": "dist/mr.js",
Expand Down
2 changes: 1 addition & 1 deletion samples/index.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>
<mr-app debug="true">
<mr-panel class="layout">
<mr-div id="navbar">
<mr-a href="https://volumetrics.io" target="_blank" class="company">
Expand Down
12 changes: 9 additions & 3 deletions src/core/componentSystems/ControlSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,16 +359,22 @@ export class ControlSystem extends MRSystem {
if (!this.currentEntity) {
this.currentEntity = entity;
this.currentEntity?.classList.add('hover');
this.currentEntity.dispatchEvent(new MouseEvent('mouseover'));
this.currentEntity.dispatchEvent(new MouseEvent('mouseover', {
bubbles: true
}));
this.currentEntity.focus = true;
} else if (!this.down && this.currentEntity != entity) {
this.currentEntity.classList.remove('hover');
this.currentEntity.dispatchEvent(new MouseEvent('mouseleave'));
this.currentEntity.dispatchEvent(new MouseEvent('mouseleave', {
bubbles: true
}));
this.currentEntity.focus = false;

this.currentEntity = entity;
this.currentEntity?.classList.add('hover');
this.currentEntity.dispatchEvent(new MouseEvent('mouseover'));
this.currentEntity.dispatchEvent(new MouseEvent('mouseover', {
bubbles: true
}));
this.currentEntity.focus = true;
}

Expand Down
8 changes: 4 additions & 4 deletions src/core/componentSystems/MaterialStyleSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export class MaterialStyleSystem extends MRSystem {
*/
update(deltaTime, frame) {
for (const entity of this.registry) {
if (!entity.needsStyleUpdate) {
return;
}
// if (!entity.needsStyleUpdate) {
// return;
// }

// Anything needed for mrjs defined entities - the order of the below matters
if (entity instanceof MRDivEntity) {
Expand All @@ -45,7 +45,7 @@ export class MaterialStyleSystem extends MRSystem {
}

// Cleanup
entity.dispatchEvent(new CustomEvent('child-updated', { bubbles: true }));
// entity.dispatchEvent(new CustomEvent('child-updated', { bubbles: true }));
if (!entity.alwaysNeedsStyleUpdate) {
entity.needsStyleUpdate = false;
}
Expand Down
8 changes: 8 additions & 0 deletions src/core/entities/MRPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ export class MRPanel extends MRDivEntity {
this.clipping.geometry.copy(new THREE.BoxGeometry(this.width, this.height, 1));
});

this.addEventListener('mouseover', () => {
this.focus = true
})

this.addEventListener('mouseleave', () => {
this.focus = false
})

document.addEventListener('wheel', (event) => {
this.onScroll(event);
});
Expand Down

0 comments on commit 270bc0d

Please sign in to comment.