-
Notifications
You must be signed in to change notification settings - Fork 1
Adjust click event threshold for XR Device ray interaction from 1px to 5px #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…raction Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about making this configurable?
…nvironment variable Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
Made the click distance threshold configurable via Android property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://www.w3.org/TR/uievents/.
This threshold is not related to the XR-specific concepts, it's defined at Web UI Events spec, please rename the related configurations in this PR.
@@ -48,6 +48,7 @@ namespace dom | |||
glm::vec3 current_scroll_end_point_; | |||
bool is_scroll_in_progress_ = false; | |||
|
|||
static inline float click_distance_threshold_ = client_cssom::pixelToMeter(1); | |||
static float getClickDistanceThreshold(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Static members should use uppercase for first char.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed static member naming to use uppercase first character: click_distance_threshold_
→ Click_distance_threshold_
. See commit 0308c1b.
…aming and fix static member naming convention Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
Renamed the configuration to follow Web UI Events spec naming. Changed Android property from |
@@ -48,6 +48,7 @@ namespace dom | |||
glm::vec3 current_scroll_end_point_; | |||
bool is_scroll_in_progress_ = false; | |||
|
|||
static inline float click_distance_threshold_ = client_cssom::pixelToMeter(1); | |||
static float getClickDistanceThreshold(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static float getClickDistanceThreshold(); | |
static float GetClickDistanceThreshold(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated function name to GetClickDistanceThreshold
with uppercase first character. See commit 959a984.
adb shell setprop jsar.click.distance.threshold 5 | ||
``` | ||
|
||
This controls the maximum distance (in pixels) between `mousedown` and `mouseup` hit points for triggering click events. The default value is 5 pixels, which provides good tolerance for ray jitter while maintaining distinction between click and drag gestures. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please explain the distance threshold at first, and add link to the related Web spec, and then provide the help to how to config it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restructured documentation to first explain the distance threshold concept with reference to Web UI Events specification, then provide configuration instructions. See commit 959a984.
To configure the click distance threshold for device ray interactions: | ||
|
||
```sh | ||
adb shell setprop jsar.click.distance.threshold 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this?
adb shell setprop jsar.click.distance.threshold 5 | |
adb shell setprop jsar.events.click_distance_threshold 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed Android property name to jsar.events.click_distance_threshold
using events namespace and underscore separator. See commit 959a984.
…erty naming, and documentation structure Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
This PR increases the click event distance threshold from 1 pixel to 5 pixels to improve click detection reliability for XR device ray interactions.
Problem
In the current implementation, click events are only triggered when the distance between
mousedown
andmouseup
hit points is less than 1 pixel. While this works well for traditional mouse interactions, XR device ray interactions often experience slight jitter that makes it difficult to trigger click events consistently.Solution
The change increases the threshold from
client_cssom::pixelToMeter(1)
toclient_cssom::pixelToMeter(5)
in theDocumentEventDispatcher
class:Technical Details
The threshold is used in the click detection logic to determine if a
selectStart
andselectEnd
event pair should generate aclick
event based on spatial proximity of the hit points.Fixes #86.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
registry.npmmirror.com
npm install
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.