ThinkGeo.com    |     Documentation    |     Premium Support

Strange Mouse Interaction after Map Resize

Hi,


If I put our WpfMap in a floating window, and perform the following steps, the map gets into a strange mode where the map moves around (Pans) without the mouse being down.


1) Resize the window to be smaller, by grabbing the lower right-hand corner


2) Move the mouse over the WpfMap, without doing anything


3) Resize the window to be larger, by grabbing the lower right-hand corner


4) Move the mouse over the map, without doing anything


 


During step 4, I am noticing that the map is acting as if I have the mouse down and am panning.  However, I do not have the mouse down.  The left mouse button is up, but the map is panning as I move the mouse over the map.  Currently, to get out of this mode I am restarting my application, and I'd like to find a better solution.


Is there some kind of a "Pan" mode that the map may have gotten into?  If there is, I could do something on my end to prevent the map from entering this mode after a resize.  Is the ThinkGeo code somehow checking the mouse button states during a resize and doing something?


I am seeing this with the 4.0 release and the previous release.


Thanks,


Greg  



Greg,


Thanks for your post and questions.
 
I am not exactly sure about your floating window means, while I tested your steps with the following attached sample, and I did not find any special.
 
Any more information would be appreciated.
 
Thanks.
 
Yale

2049-WpfApplication1.zip (9.29 KB)

A floating window is a window that is floating within a Dockable Windowing Environment.  


Given you cannot reproduce, is there anything within your api I could look at to help solve my problem on my own?  I have identified that this is related to mouse movements and panning, so there ought to be some ThinkGeo code that responds to mouse events I could leverage.


For instance, are there any events or properties related to a "Pan" state, or are there methods related to MouseMove I could override to try to figure this out?


Thanks,


Greg



Greg, 
  
 I am afraid we did not expose that logic out.  First, we have some inline events implemented in the Map Control; those implementations are not exposed to public. So, it is impossible to override, I am afraid. 
  
 About the “Pan” mode identification, we have a internal “MouseEventAnalyzer” which was utilized to analyze the kinds of mode. 
  
 I am afraid currently what you could try is to hook up your own events like this, this events will be fired after the internal MouseDown event fired. 
 winformsMap1.MouseDown += new MouseEventHandler(winformsMap1_MouseDown); 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale 


Hi,


I've done some more analysis on this and it appears that when my map starts out, the ExtentOverlay has a value of "None" for the "ExtentChangedType".  When the map changes to this weird panning behavior, the "ExtentChangedType" switches to "Pan".  We have no code that uses the ExtentOverlay in our application.


Could this be what is causing my map to get into a "Pan" mode?  If yes, what triggers the "ExtentChangedType" field to change from "None" to "Pan".  I'm guessing it is on mouse down, but in my case, the "ExtentChangedType" is in a "Pan" mode WITHOUT having the mouse down.  Also, the PanAndTrackZoomState.IsMouseLeftButtonDown is set to True when the mouse isn't down.


Is there something I could override in the ExtentOverlay and add a check like "Mouse.LeftButton == MouseButtonState.Pressed" while the map is panning, and if this isn't true, set the "ExtentChangedType" back to "None"?


Thanks,


Greg



I found the solution to this difficult to reproduce problem: 
  
 
class LayoutExtentOverlay : ExtentInteractiveOverlay
    {
        protected override void OnMapMouseMove(MapMouseMoveInteractiveOverlayEventArgs e)
        {
            if (Mouse.LeftButton == MouseButtonState.Released
                && ExtentChangedType == ExtentChangedType.Pan
                && PanAndTrackZoomState.IsMouseLeftButtonDown) {
                
                PanAndTrackZoomState.IsMouseLeftButtonDown = false;
                ExtentChangedType = ExtentChangedType.None;
            }

            base.OnMapMouseMove(e);
        }
    }


Greg, 
  
 Thanks for your sharing. 
  
 It seems that this problem is so wield, I am glad you are making some progress, thanks for your sharings of idea and code. 
  
 Any more questions just feel free to let us know. 
  
 Thanks. 
  
 Yale