Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve MarkerState API #515

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bubenheimer
Copy link
Contributor

This is a non-breaking change following suggestions from @arriolac for addressing #149: #150 (comment)

This PR does not add an onDrag callback parameter to Marker(), which would be a somewhat breaking change; this functionality is not strictly necessary and I see alternatives that may be preferable.

Summary of changes:

  1. Deprecate MarkerState.dragState and DragState enum. These were carried over from GoogleMap SDK; they are events that were mischaracterized as states.
  2. Replace with MarkerState.isDragging boolean.
  3. Clarify KDoc in several places.
  4. Add several examples providing patterns for common use cases.
  5. Organize Marker-related examples into their own folder.

Fixes #149

This is a non-breaking change following suggestions from @arriolac for addressing googlemaps#149: googlemaps#150 (comment)

This PR does not add an `onDrag` callback parameter to `Marker()`, which would be a somewhat breaking change; this functionality is not strictly necessary and I see alternatives that may be preferable.

Summary of changes:

1. Deprecate MarkerState.dragState and DragState enum. These were carried over from GoogleMap SDK; they are events that were mischaracterized as states.
2. Replace with MarkerState.isDragging boolean.
3. Clarify KDoc in several places.
4. Add several examples providing patterns for common use cases.
5. Organize Marker-related examples into their own folder.

Fixes googlemaps#149
@bubenheimer
Copy link
Contributor Author

bubenheimer commented Jan 29, 2024

To be clear: replacing MarkerState.dragState (START/DRAG/END) with MarkerState.isDragging does not lose information, because the information was not valid in the first place, due to the State vs. Event mismatch in dragState.

The MarkerDragEventsActivity example doubles as a proof of concept demonstrating how to recreate DragState events from MarkerState.isDragging plus MarkerState.position. It is equally lossy about DragState events as MarkerState.dragState, short of relying on data race details.

…States from a changing model list of marker positions by collecting results from key() composable

Rename marker examples folder to markerexamples for clarity
@bubenheimer
Copy link
Contributor Author

@wangela can I get a review for this PR, please? I'd really like to use these improvements. Thanks.

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.

Marker dragging: fix loss of drag events and difficulty observing marker positions
2 participants