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

Getting info about walk node #3

Open
chrisschaub opened this issue Apr 21, 2020 · 1 comment
Open

Getting info about walk node #3

chrisschaub opened this issue Apr 21, 2020 · 1 comment

Comments

@chrisschaub
Copy link

I am writing some custom functions to react to links being clicked within the Shapespark animation. I have it working for menu links since they come through as mouse events. But when I click on graphics in the animation, they are coming in as "WALK" nodes. These are mostly images with click events. Is there a way to tag images with an alt text or get more info about the click event -- the walk node doesn't really have anything I can use for pushing to analytics, no meaningful text.

Thanks.

@wrr
Copy link
Member

wrr commented Jul 10, 2020

Sorry for missing this issue, for some reason we didn't get notification about it.
WALK.Node represents an object that is clicked. In case of click events, every node will have a mesh attached (there are parent nodes without meshes, but such nodes cannot be clicked). Mesh always has a material, and a material with a texture will have baseColorTexture property. So your click event could do:

function onClick(node) {
  if (node.mesh.material.baseColorTexture) {
    console.log('Clicked texture: ' + node.mesh.material.baseColorTexture.name);
 }
}

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

2 participants