diff --git a/flutter_osm_web/lib/src/asset/map.html b/flutter_osm_web/lib/src/asset/map.html index 6e79fc34..35aa2d0e 100644 --- a/flutter_osm_web/lib/src/asset/map.html +++ b/flutter_osm_web/lib/src/asset/map.html @@ -249,9 +249,9 @@ if (iconMarker != "") { argsIcon["iconUrl"] = "data:image/png;base64," + iconMarker } - if (anchor != undefined && (anchor.x<=1 && anchor.y<=1)) { + if (anchor != undefined && (anchor.x <= 1 && anchor.y <= 1)) { var anchorX = anchor.x * iconSize.width - var anchorY = anchor.y * iconSize.height + var anchorY = anchor.y * (iconSize.height - 1) if(anchor.offset != undefined){ var offsetX = -anchor.offset.x var offsetY = anchor.offset.y @@ -265,6 +265,8 @@ anchorY += (offsetY) } argsIcon["iconAnchor"] = [anchorX,anchorY] + }else { + argsIcon["iconAnchor"] = [anchor.x,anchor.y] } var args = { @@ -320,11 +322,14 @@ x:iconMarker.options.iconAnchor[0], y:iconMarker.options.iconAnchor[1] }; + console.log(iconAnchor) + console.log("anchor param: "+anchor) } - if((anchor != undefined && anchor != null) && anchor!=iconAnchor) { + if((anchor != undefined && anchor != null) && anchor != iconAnchor) { iconAnchor = anchor; } mainLayers.get("markers").removeLayer(layer); + console.log(iconAnchor) addMarker(point,_iconSize,iconMarkerURL,angleMarker,iconAnchor) return this; } diff --git a/flutter_osm_web/lib/src/controller/web_osm_controller.dart b/flutter_osm_web/lib/src/controller/web_osm_controller.dart index 56d6f852..f0f4dc63 100644 --- a/flutter_osm_web/lib/src/controller/web_osm_controller.dart +++ b/flutter_osm_web/lib/src/controller/web_osm_controller.dart @@ -321,7 +321,7 @@ final class WebOsmController with WebMixin implements IBaseOSMController { newLocation.toGeoJS(), icon, iconSize, - angle != null ? (angle * (180 / pi)) : 0, + angle != null ? (angle * (180 / pi)) : null, iconAnchor?.toAnchorJS, ); });