ThinkGeo.com    |     Documentation    |     Premium Support

SimpleMarkerOverlay drag mode retaining mouse capture on marker

If you add a marker to a SimpleMarkerOverlay instance, attempt to remove but do not, you will get to a point where the marker is running away as the mouse of hovered over the map. These steps will allow you duplicate the problem using the attached source file.



1. Left click on the map on 3 different points to add a marker.
2. Right click on one of the  markers to launch the context menu.  Click on “Remove” from context menu to remove the marker.
3. Right click on another marker to bring up the context menu but do not remove it.
4. Right click on a point on the map away from this marker you attempted to remove. 
5. Hover your mouse besides the aforementioned marker and observe that the marker is behaving as if it is being dragged.  In your persist, you can get to a point where the marker starts running away from the mouse.



Also attached, is the modified version of your AddSimpleMarkers example.



Is there a work around to prevent this behavior while we wait for a fix?



TIA.

AddSimpleMarkers.xaml.cs (3.11 KB)

Hi Klaus, 
  
 Thanks for your post, we tried to recreate your problem but I am sorry to say that it didn’t show up, following is a test vedio on our end, would you please check if there are any steps we missed? screencast.com/t/yUzUqRu8hFv . we tested with the latest dlls 7.0.99.0 or 7.0.0.99(still in build will be available in hours) and would you please get them and try it again? 
  
 Best Regards 
  
 Summer

Summer, there is indeed a problem here.  



Attached is a simple project that you can use to duplicate the issue.  I have modified it slightly to add multiple markers on mouse click as I also want you to observe that the locations of these markers change when you zoom into the map.



Should I be creating a support ticket for this?



TIA.

MovingMarker.7z (9.72 KB)

Hi Klaus,



Thanks for your ticket, we have recreated the moving thing, but actually it is not a bug, the reason for this phenomenon is that the marker is a little hard to be exactly dragged to a location on a high zoom level. For example, if you drag a marker to los angles in zoom level01, though it looks to be on los angles, but actually the marker’s position maybe not exactly on los angles(though the difference is very very small to observe), and a very slight position difference on the screen in high zoomlevel will result in bigger position difference on the screen in lower zoomlevel.



Attached is a test code on our end for your information, I printed the markers’ location on the map, as you could see that the marker sticks to its own location when zoom in. Here is a test vedio for your information too: screencast.com/t/s08plzsgb ,



If you have any more question please feel free to let us know.



Best Regards



Summer

mainwindow.txt (4.32 KB)

Summer, thanks for the response.  


You will have to forgive me as the moving phenomenon ended up being an issue with our code.  


When creating multiple markers at once, we would assign a non-zero X and Y offset to prevent all of them from being added to the same geo location.  This offset is cause of the phenomenon we were observing.


I borrowed a piece of your code and reset the marker's X and Y offset to X after they have been dragged.  This solves the problem.  Thanks for looking into this.


However, we still have outstanding the issue with mouse capture.   You can use the same sample to duplicate this.



Hi Klaus, 
  
 Great to hear it is sorted out, if you have any more question, please feel free to let us know. 
  
 Best Regards 
  
 Summer

Summer, thanks for the response.  The mouse capture which I originally reported is still a problem though.

Hi Klaus, 
  
 Maybe I misunderstand your points, if that please let me know. 
  
 1. You found the markers move when zoom in. 
 2. You think the map haven’t exactly zoomed in centered by the mouse position. 
  
 For item 1 I agree with Summer’s reply, the same point in High zoomlevel and Low zoomlevel cannot excatly the same handle by mouse click. I did small changes with your sample MovingMarker.7z like this. You can click on the red point and then zoom out/in, this mark keep in the position of the red point. 
  
  
        private void WpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            wpfMap1.MapUnit = GeographyUnit.DecimalDegree;
            wpfMap1.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9);

            InMemoryFeatureLayer layer = new InMemoryFeatureLayer();
            layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 10);
            layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            layer.InternalFeatures.Add(new Feature(wpfMap1.CurrentExtent.GetCenterPoint()));
            LayerOverlay o = new LayerOverlay();
            o.Layers.Add(layer);

            //WorldMapKitWmsWpfOverlay worldMapKitOverlay = new WorldMapKitWmsWpfOverlay();
            //wpfMap1.Overlays.Add(worldMapKitOverlay);

            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();
            markerOverlay.DragMode = MarkerDragMode.Drag;

            wpfMap1.Overlays.Add(“O”, o);
            wpfMap1.Overlays.Add(“MarkerOverlay”, markerOverlay);

            wpfMap1.CurrentScale = 1126;

            wpfMap1.Refresh();
        }

 
  
 For item 2 I think our zoom in operation should be exactly. We found the mark go away from mouse position, that’s also because we cannot exactly make our pointer coincide the marker position. When we zoom in, this small deviation is magnified and the marker looks go away. 
  
 If that’s not hit your question, could you let me know how to modify the sample to reproduce your problem? 
  
 Reagards, 
  
 Don