AnsweredAssumed Answered

Home Widget's Viewpoint Autocast Gone in 4.5?

Question asked by alindley on Oct 10, 2017

After switching to 4.5 I noticed that my home-button widget wasn't working and I was receiving an error like 'Can't find extent of null'. 

 

Here is a jsBin where you can test 4.4 vs 4.5 behavior: JS Bin - Collaborative JavaScript Debugging 

 

I figured out the problem is that the 'viewpoint' property of the Home widget is not autocasting the camera object I'm passing in like it was before. Here's my working code from 4.4:

var homeBtn = new Home({
    view: view,
    viewpoint: {
      "position":[-103.96,45.6,45500],
      "heading": 10.46,
      "tilt": 30}
  });

 

The above does not work in 4.5. Now you have to import the Viewpoint module, and create a viewpoint object to pass into the Home widget's viewpoint property, like so:

var initialViewpoint = new Viewpoint ({
   camera: {
     "position":[-103.96,45.6,45500],
     "heading": 10.46,
     "tilt": 30
   }
});
var homeBtn = new Home({
   view: view,
   viewpoint: initialViewpoint
});

 

This isn't a big deal, but seems like a step backward with respect to the direction of the most recent release.

Just wanted to bring it up incase it fell through the cracks. 

 

cheers

Outcomes