Default Home Location different to flyHome location

I’ve had an issue for a while now where the default home location, when the viewer is initialised, is different to that of the flyHome location.

As soon as the viewer is ready, the drawingBufferHeight & drawingBufferWidth are both equal to 1.
When I flyHome, the drawingBufferHeight & drawingBufferWidth are equal to the HTML Element container of the viewer, lets say the screen width & height.

From looking at the Camera constructor source code, the home location is dependent upon the drawingBufferHeight & drawingBufferWidth.

I am assuming this is the cause of the inconsistencies between the default home location and the flyHome location.

I am using Angular, so the HTML Elements aren’t added to the DOM until after the viewer is ready - this may be the issue as in a standard js app everything works as expected.

Is there a way to ensure the default home location, or at least the initial view, is the same as when a user selects flyhome?

Hi @TomPovey,

Thanks for taking the time to write this out! I do suspect that the angular lifecycle has something to do with this inconsistency.

One potential workaround is to create your own custom home button and simply use the Camera object to update the location when the button is clicked.

I am unsure how the default home button is updated with a location - have you been able to find any documentation on this?

-Sam

Hi @sam.rothstein,

I’ll dig a little deeper to find out why flyHome has a different location, I know flyHome and the default view are both dependent on the DEFAULT_VIEW_RECTANGLE & DEFAULT_VIEW_FACTOR which don’t change.

Since the defaultBufferSize & defaultBufferWidth both change between the time the view is initialised and the user selects fly home, It looks like this is the issue, I’ll dig a bit deeper and let you know.

Yes no issues with creating a home button, the issue is that the location needs to match the default view when it is initialised.

You should be able to output the camera location to the console and use this information to initialize your button.

Yes, but the issue here is that the default view is zoomed in, so the whole globe isn’t visible.