Skip to content

Commit

Permalink
PB-548 : if no pitch is given while parsing a legacy camera we look down
Browse files Browse the repository at this point in the history
  • Loading branch information
pakb committed Jun 7, 2024
1 parent 1f6de01 commit 9c425bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/router/legacyPermalinkManagement.routerPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ const handleLegacyParams = async (legacyParams, store, originView) => {
)
})
if (cameraPosition.filter((value) => value !== null).length >= 3) {
// if no pitch is set, we look down to the ground instead of letting no value (0, looking at the horizon) go through
if (cameraPosition[3] === null) {
cameraPosition[3] = -90
}
newQuery['camera'] = cameraPosition.map((value) => value ?? '').join(',')
newQuery['3d'] = true
newQuery['sr'] = WEBMERCATOR.epsgNumber
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/tests-e2e/legacyParamImport.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ describe('Test on legacy param import', () => {
cy.readStoreValue('state.position.camera.y').should('eq', lat)
cy.readStoreValue('state.position.camera.z').should('eq', 0)
cy.readStoreValue('state.position.camera.heading').should('eq', heading)
cy.readStoreValue('state.position.camera.pitch').should('eq', 0)
cy.readStoreValue('state.position.camera.pitch').should('eq', -90)
cy.readStoreValue('state.position.camera.roll').should('eq', 0)

// EPSG is set to 3857
Expand Down

0 comments on commit 9c425bd

Please sign in to comment.