Ngl: NGL.Component.prototype.getCenter not implemented

Created on 27 Apr 2016  路  4Comments  路  Source: nglviewer/ngl

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

question

Most helpful comment

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... ;-)

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

harryjubb picture harryjubb  路  4Comments

harryjubb picture harryjubb  路  7Comments

pconesa picture pconesa  路  5Comments

biharck picture biharck  路  6Comments

ghost picture ghost  路  4Comments