Skip to content

Commit 41324d4

Browse files
committed
Update converters
1 parent 74d0557 commit 41324d4

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

maplibre_gl/android/src/main/java/org/maplibre/maplibregl/Convert.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,12 @@ static void interpretMapLibreMapOptions(Object o, MapLibreMapOptionsSink sink, C
256256
if (myLocationTrackingMode != null) {
257257
sink.setMyLocationTrackingMode(toInt(myLocationTrackingMode));
258258
}
259+
final Object userLocationAnchor = data.get("userLocationAnchor");
260+
if (userLocationAnchor != null) {
261+
final List userLocationAnchorData = toList(userLocationAnchor);
262+
final Point point = toPoint(userLocationAnchorData, metrics.density);
263+
sink.setUserLocationAnchor(point.x, point.y);
264+
}
259265
final Object myLocationRenderMode = data.get("myLocationRenderMode");
260266
if (myLocationRenderMode != null) {
261267
sink.setMyLocationRenderMode(toInt(myLocationRenderMode));

maplibre_gl/ios/maplibre_gl/Sources/maplibre_gl/MapLibreMapController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class MapLibreMapController: NSObject, FlutterPlatformView, MLNMapViewDelegate,
179179
guard let arguments = methodCall.arguments as? [String: Any] else { return }
180180
guard let x = arguments["x"] as? Double else { return }
181181
guard let y = arguments["y"] as? Double else { return }
182-
setUserLocationAnchorOffset(x: x, y: y)
182+
setUserLocationAnchor(x: x, y: y)
183183
result(nil)
184184
case "map#updateMyLocationTrackingMode":
185185
guard let arguments = methodCall.arguments as? [String: Any] else { return }
@@ -1767,7 +1767,7 @@ class MapLibreMapController: NSObject, FlutterPlatformView, MLNMapViewDelegate,
17671767
}
17681768
}
17691769

1770-
func setUserLocationAnchorOffset(x: Double, y: Double) {
1770+
func setUserLocationAnchor(x: Double, y: Double) {
17711771
userLocationAnchorOffset = CGPoint(x: x, y: y)
17721772
}
17731773

maplibre_gl/ios/maplibre_gl/Sources/maplibre_gl/MapLibreMapOptionsSink.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ protocol MapLibreMapOptionsSink {
1313
func setMyLocationEnabled(myLocationEnabled: Bool)
1414
func setMyLocationTrackingMode(myLocationTrackingMode: MLNUserTrackingMode)
1515
func setMyLocationRenderMode(myLocationRenderMode: MyLocationRenderMode)
16+
func setUserLocationAnchor(anchorPoint: CGPoint)
1617
func setLogoViewMargins(x: Double, y: Double)
1718
func setCompassViewPosition(position: MLNOrnamentPosition)
1819
func setCompassViewMargins(x: Double, y: Double)

maplibre_gl_web/lib/src/convert.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ class Convert {
6262
CompassViewPosition.values[options['compassViewPosition']];
6363
sink.setCompassAlignment(position);
6464
}
65+
if (options.containsKey('userLocationAnchor')) {
66+
sink.setUserLocationAnchor(
67+
options['userLocationAnchor'][0], options['userLocationAnchor'][1]);
68+
}
6569
if (options.containsKey('compassViewMargins')) {
6670
sink.setCompassViewMargins(
6771
options['compassViewMargins'][0], options['compassViewMargins'][1]);

maplibre_gl_web/lib/src/options_sink.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ abstract class MapLibreMapOptionsSink {
2727

2828
void setMyLocationRenderMode(int myLocationRenderMode);
2929

30+
void setUserLocationAnchor(double x, double y);
31+
3032
void setLogoViewMargins(int x, int y);
3133

3234
void setCompassAlignment(CompassViewPosition position);

0 commit comments

Comments
 (0)