Skip to content

PB-1595: showing mouse coordinates in 3D:#1297

Merged
ltkum merged 1 commit intodevelopfrom
fix-PB-1595-show-mouse-coordinates-in-3D
Apr 24, 2025
Merged

PB-1595: showing mouse coordinates in 3D:#1297
ltkum merged 1 commit intodevelopfrom
fix-PB-1595-show-mouse-coordinates-in-3D

Conversation

@ltkum
Copy link
Contributor

@ltkum ltkum commented Apr 14, 2025

Issues :

  • We were sending 3 pairs of Coordinates to the format function while in 3D, and the function could only handle two
  • The is3DReady flag was sometimes ready before the viewer could be accessed, leading to a situation where the handler could not be set up

Fixes :

  • We're splitting the coordinates and adding the rounded height at the end of it. (the height is optional IMO)
  • We set the isViewerReady flag to false when unMounting the 3D viewer so it can behave normally once re-created.

Test link

@github-actions github-actions bot added the bug label Apr 14, 2025
@ltkum ltkum force-pushed the fix-PB-1595-show-mouse-coordinates-in-3D branch from d56f6bf to 2eb3d64 Compare April 14, 2025 14:18
@cypress
Copy link

cypress bot commented Apr 14, 2025

web-mapviewer    Run #5121

Run Properties:  status check passed Passed #5121  •  git commit 2285b9f21d: Merge pull request #1297 from geoadmin/fix-PB-1595-show-mouse-coordinates-in-3D
Project web-mapviewer
Branch Review develop
Run status status check passed Passed #5121
Run duration 01m 23s
Commit git commit 2285b9f21d: Merge pull request #1297 from geoadmin/fix-PB-1595-show-mouse-coordinates-in-3D
Committer Martin Künzi
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 1
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 48
View all changes introduced in this branch ↗︎

@ltkum ltkum marked this pull request as ready for review April 14, 2025 14:31
@ltkum ltkum requested a review from pakb April 14, 2025 14:31
@ltkum ltkum force-pushed the fix-PB-1595-show-mouse-coordinates-in-3D branch 3 times, most recently from be895cd to 0062962 Compare April 15, 2025 14:04
const projection = computed(() => store.state.position.projection)

const dispatcher = { dispatcher: 'CesiumMouseTracker.vue' }
const getViewer = inject('getViewer', () => {}, true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd maybe more want to go in the direction where the default value returned here would be undefined, and then you can mount the component only when the function returns something relevant.

Or if not applicable to a v-if, as you are the "top component" after MapView here, you could do something like

const getCesiumViewer = inject('getViewer'), () => undefined, true)

watch(() => getCesiumViewer(), () => /* do something when the viewer changes */)

I really don't like, and want to avoid any setTimeout use when we can deal with what we want to wait differently

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started by creating a watcher on the viewer and making it a reactive components, but after a few tests, I noticed that the isViewerReady flag never changed... and so it was never set to false when we unmounted the 3D view. Since this flag is set to true once the viewer is created and ready to be used, switching that flag seems to work without needing to make the whole viewer reactive, and we no longer need to set a timeout.

@ltkum ltkum force-pushed the fix-PB-1595-show-mouse-coordinates-in-3D branch from 0062962 to abe7655 Compare April 24, 2025 07:35
@ltkum ltkum requested a review from pakb April 24, 2025 12:54
Copy link
Contributor

@pakb pakb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
WebMercator doesn't show anything somehow

(newValue) => {
if (newValue) {
setupHandler()
nextTick(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you tried removing the nextTick call? Are they still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems to work without the nextTick. Now I'm investigating the webmercator issue :)

@ltkum ltkum force-pushed the fix-PB-1595-show-mouse-coordinates-in-3D branch from b1ca2f0 to e2d165c Compare April 24, 2025 14:36
@ltkum ltkum requested a review from pakb April 24, 2025 14:36
Copy link
Contributor

@pakb pakb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to remove the now unused import of nextTick 😉

Issues :
- We were sending 3 pairs of Coordinates to the format function while in 3D, and the function could only handle two
- The is3DReady flag was sometimes ready before the viewer could be accessed, leading to a situation where the handler could not be set up

Fixes :
- We're splitting the coordinates and adding the rounded height at the end of it. (the height is optional IMO)
- We set a timeOut function which call itself while the viewer is not ready to ensure the viewer is ready before we set the handler.

meh

PB-1595: ensuring reactivity works for 3D

Issue: When going from 3d to 2d, then back to 3d, the `isViewerReady` flag stayed at true the whole time, stopping other components from watching its state. This could mean some components would see the flag as true when the viewer was not ready.
Fix: We now set the flag to false when destroying the 3d viewer. We also removed the timeouts in the mouse position plugin.

PB-1595: show webMercator labels

Issue : the webMercator labels were not displayed
Fix : we ensure the function display all labels
@ltkum ltkum force-pushed the fix-PB-1595-show-mouse-coordinates-in-3D branch from e2d165c to 16a0279 Compare April 24, 2025 15:20
@ltkum ltkum merged commit 2285b9f into develop Apr 24, 2025
6 checks passed
@ltkum ltkum deleted the fix-PB-1595-show-mouse-coordinates-in-3D branch April 24, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants