Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Disable highlight for xrui entities
Browse files Browse the repository at this point in the history
  • Loading branch information
speigg committed Aug 31, 2023
1 parent 4c188d6 commit e6e6080
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/engine/src/input/components/InputComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@ Ethereal Engine. All Rights Reserved.
import { useLayoutEffect } from 'react'

import { Entity } from '../../ecs/classes/Entity'
import { defineComponent, removeComponent, setComponent, useComponent } from '../../ecs/functions/ComponentFunctions'
import {
defineComponent,
hasComponent,
removeComponent,
setComponent,
useComponent
} from '../../ecs/functions/ComponentFunctions'
import { useEntityContext } from '../../ecs/functions/EntityFunctions'
import { HighlightComponent } from '../../renderer/components/HighlightComponent'
import { XRUIComponent } from '../../xrui/components/XRUIComponent'

export const InputComponent = defineComponent({
name: 'InputComponent',
Expand All @@ -53,7 +60,7 @@ export const InputComponent = defineComponent({
const input = useComponent(entity, InputComponent)
useLayoutEffect(() => {
if (!input.inputSources.length || !input.highlight.value) return
setComponent(entity, HighlightComponent)
if (!hasComponent(entity, XRUIComponent)) setComponent(entity, HighlightComponent)
return () => {
removeComponent(entity, HighlightComponent)
}
Expand Down

0 comments on commit e6e6080

Please sign in to comment.