Skip to content
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

handling clicks (not just hover) #16

Open
waldenn opened this issue Jun 24, 2019 · 4 comments
Open

handling clicks (not just hover) #16

waldenn opened this issue Jun 24, 2019 · 4 comments

Comments

@waldenn
Copy link

waldenn commented Jun 24, 2019

Hi,

I'm trying to achieve this zoom-effect using the aframe interface. Non aframe-code: https://github.com/vasturiano/3d-force-graph/blob/master/example/click-to-focus/index.html#L20

The "on-node-center-hover" works fine, but I was wondering how clicks should be handled in the aframe component? I see no "on-node-click" callback handler in the API. Or should "onmousedown" just be checked during hovering?

Thanks for a great project!

@vasturiano
Copy link
Owner

@waldenn this is a good question. I'm not overly familiar with how additional controllers interact with a-frame. Generally speaking in a VR environment there isn't the concept of a mouse pointer like in a regular desktop application. On the wrapping component 3d-force-graph-vr I've integrated some controller functionality:
https://github.com/vasturiano/3d-force-graph-vr/blob/master/src/3d-force-graph-vr.js#L112

Potentially this could be extended to support other types of interactions, but the challenge is to keep it generic and not device specific.

I'm totally open to ideas if you have an understanding on how to do this in an elegant manner. 😃

@waldenn
Copy link
Author

waldenn commented Jun 26, 2019

Hey Vasco,

I made a modification to the basic demo that works, based on this code. Check the console.log messages when you click on a node.

See also: aframe-mouse-cursor-component. Note: "This feature is now available in A-Frame v0.6.1 by setting "a-scene cursor="rayOrigin: mouse".

I think this should probably be documented in the API docs. I will build the zoom-demo further and report any issues below.

Other relevant documentation: interactions-and-controllers. I don't own a VR headset, so I can't test these custom events to see how generic this "cursor-click" is.

I now see there is also the event-set component. Looks like that can handle multiple event-types at once: demo

  • Question: How would I get the 3d-force-graph cameraPosition() method available in the aframe object? I don't see that method in document.querySelectorAll("[forcegraph]")[0].components. I don't understand how that code works. Where is the "cameraPosition()" function implemented?

@orzarchi
Copy link

@waldenn did you ever succeed in doing that? I can't seem to get access to the node object in order to add the event listener

@antonkulaga
Copy link

I opened an issue about super-hands integration #27 it looks like it is connected with this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants