Giter Site home page Giter Site logo

Comments (8)

vasturiano avatar vasturiano commented on May 23, 2024

@S73AM, the node-three-object property should reference a function that returns a ThreeJS Object3d. For example:

node-three-object: node => new THREE.Mesh(new THREE.BoxGeometry(5, 5, 5), new THREE.MeshBasicMaterial({ color: 'red' }))

from aframe-forcegraph-component.

AyushVisen avatar AyushVisen commented on May 23, 2024

Thanks @vasturiano for help. One more thing in which I am struggling. Can you tell me how do I add Eventlisteners to the nodes using ID? So, that if i click on any node I can perform the specific action.

from aframe-forcegraph-component.

vasturiano avatar vasturiano commented on May 23, 2024

@S73AM how do you 'click' on an aframe component? This component does not currently handle click events as that's generally controller specific.
However, it could expose a onCenterHover method that triggers whenever there is a node/link intercepted at the center of the viewport. The same manner that labels are shown currently. Would this help your case?

from aframe-forcegraph-component.

AyushVisen avatar AyushVisen commented on May 23, 2024

@vaturiano Well in my case I want to click on the nodes and open up a Page or URL after click. Is it possible?

from aframe-forcegraph-component.

AyushVisen avatar AyushVisen commented on May 23, 2024

@vasturiano Well in my case I want to click on the nodes and open up a Page or URL after click. Is it possible?

from aframe-forcegraph-component.

waldercong avatar waldercong commented on May 23, 2024

@vasturiano if you exposed onCenterHover, would that be able to return the node id of the focused node? If so, that would help my use case at least. Thanks btw!

from aframe-forcegraph-component.

vasturiano avatar vasturiano commented on May 23, 2024

@waldercong ok I've added two new callback props to the component (v2.7.0): on-node-center-hover and on-link-center-hover. Each of them passes the currently hovered node/link object as a function parameter (or null on hover out).

You should be able to use it like this:

on-node-center-hover: node => console.log(node);

You can keep track of the hovered nodes and use it to handle click or other controller events on the scene itself.

Let me know if this works for you.

from aframe-forcegraph-component.

waldercong avatar waldercong commented on May 23, 2024

Thank you!! @vasturiano

from aframe-forcegraph-component.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.