Hello,
I'm trying to write a function that will orient (center and zoom) the camera to a given selection.
I tried using stage.viewer.centerView(zoom, center), but have stumbled because component.getCenter returns undefined.
Am I along the right lines, or is there another way to do this? Is the functionality due to be added or do I need to go about it another way or try to add the functionality?
Many thanks,
Harry
Doing component.centerView( true, "102:A" ) should work when component is a StructureComponent. The arguments are zoom and a selection string.
.getCenter is only implemented for StructureComponent. It could be for SurfaceComponent. It does not make sense for a ScriptComponent. Maybe there should be a more clear distinction between "displayable" and other components.
I see the problem now, I was trying to go via the RepresentationComponent rather than the StructureComponent. Thanks for your help.
Providing the zoom as a number, does this:
zoom = Math.max( zoom, 1.2 * this.params.clipDist );
effectively mean that in the current implementation, it's not possible to zoom out by a specified number?
Sorry for the novice questions!
All the best,
Harry
The zoom argument for StructureComponent.centerView is currently a boolean flag. Eventually it support a percent value that relates to the bounding box of the structure.
Sorry for the novice questions!
I blame it all on the lack of good documentation... ;-)
Ah I see! Thank you :)
Not at all, it's a huge project, at the moment I'm learning a lot just by going through the code. Thank you for all of your efforts.
Most helpful comment
The zoom argument for
StructureComponent.centerViewis currently a boolean flag. Eventually it support a percent value that relates to the bounding box of the structure.I blame it all on the lack of good documentation... ;-)