-
-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
After upgrading Flutter Map -> 8.* and Flutter Map Dragmarker -> 8.*, the drag functionality when hitting the edge of the screen (left or top) is failing. The markers disappear and reappear when moving the map. Dragging to the right or bottom is fine.
I believe this is attributed to the change in the DragMarker class which was required for compatibility with flutter_map 8.*.
Version 8.0.1:
/// This method checks if the marker is in the current map bounds
bool inMapBounds({
required final MapCamera mapCamera,
required final Alignment markerWidgetAlignment,
}) {
var pxPoint = mapCamera.projectAtZoom(point);
final left =
0.5 * size.width * ((alignment ?? markerWidgetAlignment).x + 1);
final top =
0.5 * size.height * ((alignment ?? markerWidgetAlignment).y + 1);
final right = size.width - left;
final bottom = size.height - top;
final offset = Offset(pxPoint.dx - right, pxPoint.dy - bottom);
return mapCamera.pixelBounds.contains(offset);
}
Same method in v7.0.0:
bool inMapBounds({
required final MapCamera mapCamera,
required final Alignment markerWidgetAlignment,
}) {
var pxPoint = mapCamera.project(point);
final left =
0.5 * size.width * ((alignment ?? markerWidgetAlignment).x + 1);
final top =
0.5 * size.height * ((alignment ?? markerWidgetAlignment).y + 1);
final right = size.width - left;
final bottom = size.height - top;
final bounds = Bounds(
Point(pxPoint.x + left, pxPoint.y - bottom),
Point(pxPoint.x - right, pxPoint.y + top),
);
return mapCamera.pixelBounds.containsPartialBounds(bounds);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels