Skip to content

fix: flyTo breaks following mode with untilPanOrZoom#396

Merged
KristjanESPERANTO merged 1 commit intodomoritz:gh-pagesfrom
KristjanESPERANTO:fix/issue-314
Feb 9, 2026
Merged

fix: flyTo breaks following mode with untilPanOrZoom#396
KristjanESPERANTO merged 1 commit intodomoritz:gh-pagesfrom
KristjanESPERANTO:fix/issue-314

Conversation

@KristjanESPERANTO
Copy link
Copy Markdown
Collaborator

Fixes #314 - flyTo breaking following mode with untilPanOrZoom.

Control-initiated flyTo calls triggered zoomstart events which were interpreted as user actions, causing _userZoomed = true and immediately breaking following mode.

Root Cause

Only the fitBounds path in setView() was setting _ignoreEvent before map operations. The initialZoomLevel and keepCurrentZoomLevel paths were unprotected, so their flyTo/setView/panTo calls triggered _onZoom().

Solution

Set _ignoreEvent = true for all three code paths in setView() before calling map methods. Extract common pattern into _setViewIgnoringEvents(method, args) helper to eliminate duplication.

Changes

  • Protected all setView() paths with _ignoreEvent flag
  • Added _setViewIgnoringEvents() helper method
  • Modernized setView(): destructuring, string method names, clearer variables
  • Removed dead code in fitBounds path
  • Added two tests verifying the fix

Notes

Implements option 2 from the original issue analysis: "_onZoom should ignore the event while the zoom happens due to flyTo"

When using flyTo: true with initialZoomLevel or keepCurrentZoomLevel,
the flyTo call triggered zoomstart events which set _userZoomed = true,
immediately breaking following mode even though the zoom was triggered
by the control itself, not by the user.

Root cause: Only the fitBounds path in setView() was setting _ignoreEvent
to prevent zoom/pan events from being interpreted as user actions.

Fixes domoritz#314
@KristjanESPERANTO KristjanESPERANTO merged commit 7a6cd22 into domoritz:gh-pages Feb 9, 2026
1 check passed
@KristjanESPERANTO KristjanESPERANTO deleted the fix/issue-314 branch February 9, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flyTo and untilPanOrZoom combination breaks following

2 participants