Skip to content

Conversation

@ismailsunni
Copy link
Contributor

@ismailsunni ismailsunni commented Nov 5, 2025

Test link

Geolocation Button System - Behavior Summary

1. Geolocation Button (Location Arrow Icon)

Purpose

Toggles geolocation detection on/off

Visual States

  • Inactive: Gray, not highlighted
  • Active: Highlighted background
  • Disabled: Grayed out (permission denied)

Behavior

When clicked (geolocation OFF):

  • ✓ Activates geolocation
  • ✓ Shows user position marker on map
  • ✗ Does NOT enable tracking (map does not follow)
  • ✗ Does NOT enable auto-rotation

When clicked (geolocation ON):

  • ✓ Deactivates geolocation
  • ✓ Hides position marker
  • ✓ Disables tracking (if it was on)
  • ✓ Disables auto-rotation (if it was on)
  • ✓ Resets map rotation to north

Tooltip

  • "Start geolocation" (when off)
  • "Stop tracking" (when on)

Always Visible

Yes (unless permission denied)


2. Recenter Button (Arrows-to-Circle Icon)

Purpose

Toggles continuous position tracking and auto-rotation

Visual States

  • Inactive: Gray, not highlighted (tracking OFF)
  • Active: Highlighted background (tracking ON)

Behavior

When clicked (tracking OFF):

  • ✓ Enables tracking (map follows user continuously)
  • ✓ Centers map on user position
  • ✓ Enables auto-rotation (if device has orientation sensor)

When clicked (tracking ON):

  • ✓ Disables tracking (map stops following)
  • ✓ Disables auto-rotation (if it was on)
  • ✓ Resets rotation to north

Tooltip

  • "Re-center map" (when tracking off)
  • "Stop tracking" (when tracking on)

Visibility

Shows when:

  • Geolocation is active AND
  • User position is available

Hides when:

  • Geolocation is off OR
  • No position available yet

3. Compass Button (North Arrow Icon)

Purpose

Resets map rotation to north and disables auto-rotation

Behavior

When clicked:

  • ✓ Resets map rotation to 0° (north)
  • ✓ Disables auto-rotation
  • ✓ Smooth rotation animation

Tooltip

  • "Reset rotation"

Visibility

Shows when:

  • Map is rotated (rotation ≠ 0°) OR
  • (Geolocation active AND auto-rotation is enabled)

Hides when:

  • Map facing north (rotation = 0°) AND
  • (Geolocation off OR auto-rotation disabled)

Test link

@github-actions github-actions bot added the bug label Nov 5, 2025
@ismailsunni ismailsunni force-pushed the fix-pb-2058-geolocation-zoom-level branch from 7197e5d to 275bd15 Compare November 5, 2025 04:54
@ismailsunni ismailsunni requested a review from Copilot November 5, 2025 04:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the order of operations in handleNewGeolocationPosition to ensure that map centering occurs before position updates, preventing a potential race condition where setCenter might disable tracking. The code has also been reorganized to add debug logging when tracking is disabled.

  • Moved position/accuracy update logic to execute after the map centering logic
  • Added debug logging for when setCenterIfInBounds is skipped due to tracking being false
  • Added clarifying comment about the importance of the execution order

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ismailsunni ismailsunni marked this pull request as ready for review November 5, 2025 05:20
@ismailsunni ismailsunni requested a review from pakb November 5, 2025 05:20
@cypress
Copy link

cypress bot commented Nov 5, 2025

web-mapviewer    Run #6133

Run Properties:  status check failed Failed #6133  •  git commit b3f956d61b: PB-2068: Fix missing import on 3D geolocation test.
Project web-mapviewer
Branch Review fix-pb-2058-geolocation-zoom-level
Run status status check failed Failed #6133
Run duration 19m 07s
Commit git commit b3f956d61b: PB-2068: Fix missing import on 3D geolocation test.
Committer Ismail Sunni
View all properties for this run ↗︎

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

Tests for review

Failed  print.cy.ts • 1 failed test • e2e/chrome/mobile

View Output

Test Artifacts
An uncaught error was detected outside of a test Test Replay Screenshots
Failed  timeSlider.cy.ts • 3 failed tests • e2e/chrome/mobile

View Output

Test Artifacts
Cypress tests covering the time slider, its functionalities and its URL parameter > checking the time slider behavior, both on startup and during use > checks that the time slider is functional and behave correctly part 1 Test Replay Screenshots
Cypress tests covering the time slider, its functionalities and its URL parameter > checking the time slider behavior, both on startup and during use > checks that the time slider is functional and behave correctly with the timeSlider param at startup Test Replay Screenshots
Cypress tests covering the time slider, its functionalities and its URL parameter > checking the time slider behavior, both on startup and during use > behaves correctly when years are being entered in the input Test Replay Screenshots
Failed  legacyParamImport.cy.ts • 1 failed test • e2e/chrome/mobile

View Output

Test Artifacts
An uncaught error was detected outside of a test Test Replay Screenshots
Failed  layers.cy.ts • 1 failed test • e2e/chrome/mobile

View Output

Test Artifacts
An uncaught error was detected outside of a test Test Replay Screenshots
Failed  changeLanguage.cy.ts • 1 failed test • e2e/chrome/mobile

View Output

Test Artifacts
An uncaught error was detected outside of a test Test Replay Screenshots

The first 5 failed specs are shown, see all 24 specs in Cypress Cloud.

Base automatically changed from fix-pb-2055-fix-drag-drop-layer-reorder to feat-PB-1383-pinia-store November 5, 2025 08:02
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.

On my phone I am unable to disable geolocation anymore, the tracking "flag" always kicks in and reset the button to the first state (and we need the button to be in the "second" state and click it to disable the geolocation)

Are you able to test that out yourself, being outside the zone covered by the map? 🙈

@ismailsunni
Copy link
Contributor Author

@pakb I can test it with FakeGPS. So, the issue is only on mobile, or is it also on desktop/web?

By the way, do we have documentation on how this geolocation/tracking feature should work (i.e., the expected behavior)?

@ismailsunni ismailsunni force-pushed the fix-pb-2058-geolocation-zoom-level branch from b6b1777 to cf688f4 Compare November 11, 2025 09:14
@ismailsunni ismailsunni requested a review from pakb November 12, 2025 06:16
@ismailsunni ismailsunni force-pushed the fix-pb-2058-geolocation-zoom-level branch from 7d1e58b to 8a429f1 Compare November 13, 2025 08:37
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.

Like the "compass" button that only shows up whenever the map rotation isn't "zero", I'd hide the "re-center" button when we are tracking, instead of switching it to red/active

@ismailsunni
Copy link
Contributor Author

@pakb, if we hide the "re-center" button while tracking, how do we "recommend" a way for a user to disable the tracking without disabling the geolocation? Pan the map is possible, though.

@ismailsunni
Copy link
Contributor Author

@pakb I implemented it :)

@ismailsunni ismailsunni requested a review from pakb November 13, 2025 15:54
@ismailsunni ismailsunni force-pushed the fix-pb-2058-geolocation-zoom-level branch from 0cc78ef to 31642a5 Compare November 14, 2025 04:39
@sommerfe sommerfe force-pushed the feat-PB-1383-pinia-store branch from a1cccff to 9e6d8d7 Compare December 2, 2025 08:43
@ismailsunni ismailsunni force-pushed the fix-pb-2058-geolocation-zoom-level branch from 31642a5 to c28fc93 Compare December 3, 2025 02:10
@ismailsunni ismailsunni requested a review from pakb December 3, 2025 02:26
- Recenter button now uses distance-based check (>1m from user location) instead of tracking flag
- Fix compass button not hiding when rotation reset to north (falsy check bug)
- Adjust compass button visibility based on geolocation state
- Add comments documenting button visibility conditions
…tion.

Only reset rotation to north when auto-rotation was active, preserving
manual user rotations when geolocation is disabled.
…vent.

- Restore hasTrackingFeedback behavior that was missing from TS migration
- Add circle icon overlay for visual feedback when tracking is disabled
- Change event listener from movestart to pointerdrag to only disable tracking on deliberate map drag, not on zoom/rotate
- Add post-activation tracking check
- Comment out RecenterButton (to be re-enabled later)
- Fix TODO bug in setCenter that disabled tracking when geolocation updated the position
- Check dispatcher name to distinguish between geolocation updates and user map movements
- Always enable tracking unconditionally after geolocation activation
- This fixes the 3-phase bug where tracking would be disabled immediately after activation
Geolocation button now only toggles location detection on/off.
Recenter button controls tracking and auto-rotation.
Tracking is disabled by default when geolocation activates.
…tes it

Include RecenterButton in geolocation dispatcher check to prevent
setCenter from immediately disabling tracking when it gets enabled.
Register faArrowsToCircle in FontAwesome library and use it
in RecenterButton for better visual indication of tracking mode.
@ismailsunni ismailsunni force-pushed the fix-pb-2058-geolocation-zoom-level branch from 16125b9 to b3f956d Compare December 4, 2025 06:40
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.

When re-activating geolocation, the view is centered on the geolocation position, but the "re-center" is still visible.
I think we shouldn't re-center the view when we re-activate the geolocation (so the n+1 time it's activated, we only show on the map without moving the map)

Comment on lines +18 to +28
): void
export default function setCenter(
this: PositionStore,
center: SingleCoordinate,
dispatcher: ActionDispatcher
): void
export default function setCenter(
this: PositionStore,
center: SingleCoordinate,
preserveGeolocationTrackingOrDispatcher: boolean | ActionDispatcher,
dispatcherOrNothing?: ActionDispatcher
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you switch to using an "options" bag, instead of having the boolean straight into the signature?

I think it would clarify a bit better the code when the function is used

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.

3 participants