Skip to content

Commit

Permalink
Disable the hover effect while in inspect mode
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Jan 23, 2024
1 parent 1f7c920 commit b0082b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/bit-systems/hoverable-visuals-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
HoveredHandRight,
HoveredRemoteLeft,
HoveredRemoteRight,
Inspected,
RemoteLeft,
RemoteRight
} from "../bit-components";
Expand Down Expand Up @@ -45,9 +46,10 @@ export function hoverableVisualsSystem(world: HubsWorld) {
hoverableVisualsExitQuery(world).forEach(eid => HoverableVisualsUniforms.delete(eid));
hoverableVisualsEnterQuery(world).forEach(eid => updateHoverableVisuals(world, eid));
hoverableVisualsQuery(world).forEach(eid => {
const isInspecting = anyEntityWith(world, Inspected);
const isFrozen = APP.scene!.is("frozen");
const isEntityPinned = isPinned(eid);
const showEffect = !isEntityPinned || isFrozen;
const showEffect = (!isEntityPinned && !isInspecting) || isFrozen;

const uniforms = HoverableVisualsUniforms.get(eid);
if (uniforms && uniforms.length) {
Expand Down
4 changes: 3 additions & 1 deletion src/utils/permissions-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { hasComponent } from "bitecs";
import { HoldableButton } from "../bit-components";
import { CAMERA_MODE_INSPECT } from "../systems/camera-system";

// https://github.com/mozilla/hubs/wiki/Hubs-authorization
export function showHoverEffect(el) {
Expand All @@ -15,7 +16,8 @@ export function showHoverEffect(el) {
? window.APP.hubChannel.can("spawn_emoji")
: window.APP.hubChannel.can("spawn_and_move_media")) &&
(!isPinned || window.APP.hubChannel.can("pin_objects"));
return (isSpawner || !isPinned || isFrozen) && canMove;
const isInspecting = el.sceneEl.systems["hubs-systems"].cameraSystem.mode === CAMERA_MODE_INSPECT;
return (isSpawner || !isPinned || isFrozen) && canMove && !isInspecting;
}

export function canMove(entity) {
Expand Down

0 comments on commit b0082b9

Please sign in to comment.