changeMarker method
Future<void>
changeMarker({
- required GeoPoint oldLocation,
- required GeoPoint newLocation,
- MarkerIcon? newMarkerIcon,
- double? angle = null,
- IconAnchor? iconAnchor,
Implementation
@override
Future<void> changeMarker({
required GeoPoint oldLocation,
required GeoPoint newLocation,
MarkerIcon? newMarkerIcon,
double? angle = null,
IconAnchor? iconAnchor,
}) async {
var duration = 0;
if (newMarkerIcon != null) {
duration = 300;
osmWebFlutterState.widget.dynamicMarkerWidgetNotifier.value =
newMarkerIcon;
}
await Future.delayed(Duration(milliseconds: duration), () async {
var icon = null;
SizeJs? iconSize;
if (newMarkerIcon != null) {
final iconPNG = await capturePng(osmWebFlutterState.dynamicMarkerKey!);
icon = iconPNG.convertToString();
final size = osmWebFlutterState.dynamicMarkerKey?.currentContext?.size;
iconSize = size.toSizeJS();
}
debugPrint(
"changedMarker:angle:${angle != null ? (angle * (180 / pi)) : 0}");
await interop.changeMarker(
mapIdMixin,
oldLocation.toGeoJS(),
newLocation.toGeoJS(),
icon,
iconSize,
angle != null ? (angle * (180 / pi)) : 0,
iconAnchor?.toAnchorJS,
);
});
}