Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/src/mapbox_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ class MapboxMap extends StatefulWidget {
/// when the map tries to turn on the My Location layer.
final bool myLocationEnabled;

/// The mode used to let the map's camera follow the device's physical location
/// The mode used to let the map's camera follow the device's physical location.
/// `myLocationEnabled` needs to be true for values other than `MyLocationTrackingMode.None` to work.
final MyLocationTrackingMode myLocationTrackingMode;

/// The mode to render the user location symbol
Expand Down
1 change: 1 addition & 0 deletions mapbox_gl_web/lib/src/convert.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Convert {
sink.setMyLocationEnabled(options['myLocationEnabled']);
}
if (options.containsKey('myLocationTrackingMode')) {
//Should not be invoked before sink.setMyLocationEnabled()
sink.setMyLocationTrackingMode(options['myLocationTrackingMode']);
}
if (options.containsKey('myLocationRenderMode')) {
Expand Down
4 changes: 4 additions & 0 deletions mapbox_gl_web/lib/src/mapbox_map_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,10 @@ class MapboxMapController extends MapboxGlPlatform

@override
void setMyLocationTrackingMode(int myLocationTrackingMode) {
if(_geolocateControl==null){
//myLocationEnabled is false, ignore myLocationTrackingMode
return;
}
if (myLocationTrackingMode == 0) {
_addGeolocateControl(trackUserLocation: false);
} else {
Expand Down