Add Pitch to DEFAULT_VIEW_RECTANGLE

56 views
Skip to first unread message

Chase Gatyas

unread,
Dec 26, 2018, 6:06:04 PM12/26/18
to cesium-dev
I have the DEFAULT_VIEW_RECTANGLE set up and working as expected, however I would like to add a pitch to this view. 

const rectangle = Cesium.Rectangle.fromDegrees(west, south, east, north);

Cesium.Camera.DEFAULT_VIEW_RECTANGLE = rectangle;
Cesium.Camera.DEFAULT_VIEW_FACTOR = 0;


I can use setView() to control the default view that loads in, however I also want the Home button to go back to this view. Using the pitch below I get the default camera angle I want however clicking the Home button defaults to the DEFAULT_VIEW_RECTANGLE and I can not figure out how to either incorporate a pitch into that OR how to use the setView() as the default home. 

camera.setView({
 destination
: Cesium.Cartesian3.fromDegrees(-95, 15, 3500000),
 orientation
: {
 heading
: 0.0,
 pitch
: Cesium.Math.toRadians(-62.5),
 roll
: Cesium.Math.toRadians(0)
 
}

Ultimately open to doing this another way, just want to have a default pitch when the viewer loads, and retain that pitch when you click the Home button.

Thank you,
Chase

Cesium 1.5.0 on Windows, using Chrome. 



Omar Shehata

unread,
Jan 2, 2019, 1:53:19 PM1/2/19
to cesium-dev
I don't see an easy way to override this in CesiumJS. I opened a GitHub issue inquiring about that here:


As I alluded there, my best guess is it might be easier to make your own button, and that way you can control exactly what the home view looks like. This is what the button does when clicked:


And what the flyHome function does:

Chase Gatyas

unread,
Jan 2, 2019, 3:06:59 PM1/2/19
to cesium-dev
Thank you Omar, I will try and create a custom button. 
Reply all
Reply to author
Forward
0 new messages