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

setParameters on shape component #376

Open
giagitom opened this issue Aug 30, 2017 · 6 comments
Open

setParameters on shape component #376

giagitom opened this issue Aug 30, 2017 · 6 comments
Labels

Comments

@giagitom
Copy link
Collaborator

giagitom commented Aug 30, 2017

Hi, I have two questions about shape components.

I have a shape component with a cylinder and a label. Is it possible to alter the color and the size of both objects in the shape component without disposing and rebuilding entirely (like using a setParameter method)?

And is it possible to keep the label in front of the cylinder like a distance representation?

@arose arose added the question label Sep 1, 2017
@arose
Copy link
Collaborator

arose commented Sep 1, 2017

I have a shape component with a cylinder and a label. Is it possible to alter the color and the size of both objects in the shape component without disposing and rebuilding entirely (like using a setParameter method)?

No, not possible. If you have a large number of cylinders and labels it is good to create CylinderBuffer and TextBuffer objects instead of shape.addCylinder and shape.addLabel, plus you can change the color and size of the buffer objects without disposing and rebuilding. See this example https://codepen.io/arose/pen/qXgxap?editors=0010.

And is it possible to keep the label in front of the cylinder like a distance representation?

Yes, using the zOffset parameter http://nglviewer.org/ngldev/api/typedef/index.html#static-typedef-TextBufferParameters, for shape.addLabel set it when instantiating new Shape({labelParams: {zOffset: 5}})

@giagitom
Copy link
Collaborator Author

giagitom commented Sep 2, 2017

Great solution, only one thing. In my example hear I tried to alter the length of a cylinder created before and at the same time tried to add two other cylinders. I noticed that the dimension of the first cylinder was changed but the other cylinders did not appeared. Is it possible that the new buffers length is not updated?

@arose
Copy link
Collaborator

arose commented Sep 13, 2017

At the moment it is not possible to alter the size of buffers, you will need to re-create them. There is some exception for mesh-buffer (which makes changing the isosurface threshold so fast) but I haven't generalized that. Eventually it will be possible.

@lenhsherr
Copy link

Is there anyway to alter the opacity of a buffer?

@arose
Copy link
Collaborator

arose commented Sep 30, 2017

keep a reference to the buffer and then do buffer.setParameters({opacity: 0.5})

@garboit
Copy link

garboit commented Feb 6, 2022

Is it possible to add a tooltip/hover text to buffers the way it is done with shapes?

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

No branches or pull requests

4 participants