feat(xr): XrMenu label items, ray picking, always-visible HUD mode#8770
Merged
Conversation
Extend XrMenu with label-only items, runtime label updates, custom XR ray picking, and an always-visible camera-anchored mode. Adds a new vr-test-bed example that uses these features as an in-VR debug HUD for tweaking app.xr.fixedFoveation. Changes: - Items without an eventName render as non-interactive labels (skipped click/hover, dimmer text). - New XrMenu#setItemLabel(index, text) updates an item's text at runtime; persists into menuItems. Label text is no longer auto-uppercased — caller controls casing. - New alwaysVisible mode + followDistance / followOffset (Vec2) keeps the menu pinned to the camera for the whole session. - Self-contained XR ray picking via element worldCorners; trigger edge-detect for clicks. Does not depend on ElementInput XR hover. - Restyled defaults: slate background, cyan hover/press, near-white text. - Press cooldown debounce in _onButtonClick. Examples: - New vr-test-bed example: always-visible HUD with foveation toggle / +/- / exit buttons, controller-ray drawing. - xr-menu example: pre-uppercased the three labels so its visual output is unchanged after dropping the implicit uppercase. - New thumbnails for vr-test-bed; updated vr-basic thumbnail to match since both render the same gallery scene.
Removes the localStorage-backed logger, _onButtonClick wrapper, global error nets, and per-handler tracing that were added while investigating the WebGPU foveation crash on Quest 3. Functionality is unchanged; clears the CI lint errors (no-use-before-define, brace-style, arrow-parens).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extend XrMenu with label-only items, runtime label updates, custom XR ray picking, and an always-visible camera-anchored mode. Adds a new
vr-test-bedexample that uses these features as an in-VR debug HUD for tweakingapp.xr.fixedFoveation.Changes:
XrMenuitems without aneventNamenow render as non-interactive labels (skipped click/hover, dimmer text). Useful for value readouts alongside interactive buttons.XrMenu#setItemLabel(index, text)method updates the displayed text of any item at runtime; persists intomenuItemsso it survives a future regeneration. No moretoUpperCase()on labels — caller controls casing.XrMenu#alwaysVisiblemode: the menu stays up for the entire XR session and follows the camera. Configurable withfollowDistanceandfollowOffset(Vec2 — camera-local right + up).worldCornersfor ray-vs-plane interaction and edge-detects the controller trigger for clicks. Does not depend on ElementInput's XR hover events (which are unreliable on some runtimes)._onButtonClickto avoid double-firing when multiple input paths see the same press.API Changes:
XrMenu#setItemLabel(index, text): boolean— updates an item's text.alwaysVisible: boolean,followDistance: number,followOffset: Vec2,labelTextOpacity: number.{ label }(noeventName) is now a valid label-only row.xr-menuexample labels were updated to preserve the previous visual.Examples:
examples/src/examples/xr/vr-test-bed.example.mjs: always-visible HUD with foveation toggle / +/- / exit buttons, controller-ray drawing, and a known WebGPU-foveation-on-Quest-3 caveat documented in-code.xr-menuexample: pre-uppercased the three menu labels so its visual output is unchanged after dropping the implicit uppercase.vr-test-bed; updatedvr-basicthumbnail to match since both render the same gallery scene.