osm_flutter
                                
                                 osm_flutter copied to clipboard
                                
                                    osm_flutter copied to clipboard
                            
                            
                            
                        enableStopFollow dont work
Hi,
if i call
await controller.enableTracking(enableStopFollow: true);
map is still following my position
Iam using Android device
Can u please fix it? thank you
it will only follow for first time or still map follow the user location changes?
map following user position all the time, i can disable it only if i drag map
enableStopFollow parameter true/false it does not matter
i will check the issue
which version you're using ?
v0.53.4+1
i will fix the issue but i want to know is better to make one api for activate user location and tracking or keep it like this
since in our plugin we have currentLocation and enableTracking
second approach would be better (saperatelly activate show current position, and saparatelly enable/disable follow)
check the new version 0.54.0
still doesnt work
i have trackMyPosition: true, and then i have button and onclick await controller.enableTracking(enableStopFollow: true); but camera still following current position
i made new adjustment for latest fix. check our new version 0.54.1
stil not working, param enableStopFollow true/false seems wont change anything
can you share part of your code ?
MapController controller = MapController(
      initMapWithUserPosition: false,
      initPosition: GeoPoint(latitude: 48.578424, longitude: 19.131043));
OSMFlutter(
                    onMapIsReady: (ready) async {
                      if (ready) {
                        setState(() {
                          isMapReady = true;
                        });
                        setupScreen();
                      }
                    },
                    onLocationChanged: (point) { // THIS also dont work, only one time called 
                      onLocationChanged(point);
                    },
                    isPicker: false,
                    controller: controller,
                    userLocationMarker: UserLocationMaker(   // THIS also dont work, wrong anchor on icon
                      personMarker: MarkerIcon(
                        iconWidget: SvgPicture.asset(
                          "assets/graphics/my_position_icon.svg",
                          height: 36,
                        ),
                      ),
                      directionArrowMarker: MarkerIcon(
                        iconWidget: SvgPicture.asset(
                          "assets/graphics/my_position_icon.svg",
                          height: 36,
                        ),
                      ),
                    ),
                    trackMyPosition: true,
                    initZoom: 16,
                    minZoomLevel: 8,
                    maxZoomLevel: 19,
                    stepZoom: 1.0,
                    markerOption: MarkerOption(
                        advancedPickerMarker: MarkerIcon(
                          icon: Icon(
                            Icons.push_pin_sharp,
                            color: Colors.deepPurple,
                            size: 120,
                          ),
                        ),
                        defaultMarker: MarkerIcon(
                          icon: Icon(
                            Icons.person_pin_circle,
                            color: Colors.blueAccent,
                            size: 56,
                          ),
                        )),
                  ))),
Positioned(
            child: new FloatingActionButton(
              child: new Icon(Icons.my_location, color: Colors.white),
              onPressed: () async {
                await controller.enableTracking(enableStopFollow: true);
              },
            ),
i check the use case it should work fine can provide me your expection when enableStopFollow = true ? what exactly you use case ? because enableStopFollow = true will just disable the follow means that you can move the map freely
hmm i need call some method to stop following my current position(but still showing it on map)
now i need to call await controller.enableTracking(enableStopFollow: true); and then click manually on map to stop follow
u said "enableStopFollow = true will just disable the follow means that you can move the map freely", so its just unlocking map moving gesture. But i need just stop centering mapp when my position changed
just stopMovingCameraToMyPosition()
we have disableTracking also enableStopFollow = true will keep getting user location but will not disable the tracking
disableTracking remove my position from map
and you don't want that behavior ?
maybe some new function: stop centering camera on my position but keep it on map
i tought enableStopFollow is this function, but it just enable/disable gestures to move map, maybe some other name for this param will be better, eg. lockedMap: true/false
controller.enableTracking(enableStopFollow: true); = STOP centering map on my location controller.enableTracking(enableStopFollow: false); = START centering map on my location
controller.enableTracking(lockedMap: true); = enableStopFollow: true at this moment controller.enableTracking(lockedMap: false); = enableStopFollow: false at this moment
OSMFlutter(
                    trackMyPosition: true,
                    followMyPosition: false,   // just center it on first fix then dont follow
                  )
check new version 0.54.2
sorry i dont know how to use it, can u add some example how to call something to stop following my position?
check new version 0.55.0
we added UserTrackOption in MapController.withUserPosition
try to put unFollowUser to false and told me the result
in general we disable the follow of the user but the trcking still active
seems worse than before.
controller = MapController(
          initMapWithUserPosition: UserTrackingOption(enableTracking: true,unFollowUser: false)
unFollowUser true or false doesnt matter, camera still moving to my position as i move.
and now i cant init map with this
initPosition: GeoPoint(latitude: 48.578424, longitude: 19.131043)
becouse now i must set initMapWithUserPosition, and if dont have permission to gps map is never get initialized.
before commit, i could put
initMapWithUserPosition:false 
initPosition: GeoPoint(latitude: 48.578424, longitude: 19.131043) 
trackMyPosition: true
can u just revert changes and make just one method eg. controller.followUser(true/false) to dynamically follow/unfollow user?
sorry to hear that but in from 0.55+ you should use named constructor .withPosition or withUserPosition and i will add UserTrackOption to replace the removed attribute trackMyPosition
for information that unFollowUser does the what you want I will record video to show you how its works
controller = MapController.withUserPosition(trackUserLocation: UserTrackingOption(enableTracking: true,unFollowUser: true)
or
controller = MapController.withUserPosition(trackUserLocation: UserTrackingOption(enableTracking: true,unFollowUser: false)
both still animating camera to my current location when i move
and now onMapIsReady not trigered if i dont allow location permission
before, i could decline permission and onMapIsReady true was triggered
ok i will wait for video to check this
I think I get your use case you want to init map with position and enable user location without changing map to the user location from the begninning Am I wrong ?
init map with position was just workaround if u dont enable gps to trigger mapIsReady anyway.
before last commit it was good
- start app
- while mapIsReady false, show some logo
- popup to ask gps permission a. allow = mapIsReady true, move camera to my position b. decline = mapIsReady true, move camera to initial position
- what i want at beggining, stop follow but still show my position
so i want at the beggining change map to user location, but i want ability to dynamically turn it off/on (changing map to user location)
i had simple workaround programmatically drag map, that's all this does what i want
  disableFollowHack() async {
    GestureBinding.instance!.handlePointerEvent(PointerDownEvent(
      position: Offset(200, 300),
    ));
    await Future.delayed(Duration(milliseconds: 500));
    GestureBinding.instance!.handlePointerEvent(PointerUpEvent(
      position: Offset(200, 300),
    ));
  }
https://drive.google.com/file/d/1diHkoCO_98MbGUX1wDwwbwxp9YAgBavP/view?usp=sharing
check the video, i click both methods and only difference is if i click TRUE then i can drag map, if i drag the map thats is the functionality that i want, just stop follow
i will make update tonight or tomorrow at max It will contain replacement for trackMyPosition in OSMFlutter and fix when enableStopFollow : false