mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-25 00:14:42 +01:00
Fix OSM marker size when there's only one item in cluster
This commit is contained in:
parent
820806ee66
commit
a9de0b315c
1 changed files with 12 additions and 2 deletions
|
@ -74,11 +74,12 @@ class _OsmInteractiveMapState extends State<OsmInteractiveMap> {
|
||||||
markers.cast<_OsmDataPoint>().map((e) => e.original).toList(),
|
markers.cast<_OsmDataPoint>().map((e) => e.original).toList(),
|
||||||
),
|
),
|
||||||
// need to be large enough to contain markers of all size
|
// need to be large enough to contain markers of all size
|
||||||
size: const Size.square(120),
|
size: const Size.square(_markerBoundingBoxSize),
|
||||||
// disable all tap handlers from package
|
// disable all tap handlers from package
|
||||||
zoomToBoundsOnClick: false,
|
zoomToBoundsOnClick: false,
|
||||||
centerMarkerOnClick: false,
|
centerMarkerOnClick: false,
|
||||||
spiderfyCluster: false,
|
spiderfyCluster: false,
|
||||||
|
markerChildBehavior: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -110,7 +111,11 @@ class _OsmDataPoint extends Marker {
|
||||||
_OsmDataPoint({
|
_OsmDataPoint({
|
||||||
required this.original,
|
required this.original,
|
||||||
required super.child,
|
required super.child,
|
||||||
}) : super(point: original.position.toLatLng());
|
}) : super(
|
||||||
|
point: original.position.toLatLng(),
|
||||||
|
width: _markerBoundingBoxSize,
|
||||||
|
height: _markerBoundingBoxSize,
|
||||||
|
);
|
||||||
|
|
||||||
final DataPoint original;
|
final DataPoint original;
|
||||||
}
|
}
|
||||||
|
@ -129,3 +134,8 @@ class _ParentController implements InteractiveMapController {
|
||||||
extension on MapCoord {
|
extension on MapCoord {
|
||||||
LatLng toLatLng() => LatLng(latitude, longitude);
|
LatLng toLatLng() => LatLng(latitude, longitude);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// define the size of each marker's bounding box. This is NOT necessarily the
|
||||||
|
// size of the marker, it's merely the size of its bounding box and the actual
|
||||||
|
// size of the content is determined by the child (e.g., the Container widget)
|
||||||
|
const _markerBoundingBoxSize = 120.0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue