ThinkGeo.com    |     Documentation    |     Premium Support

Change pan behavior from left to right click

Hi,
How can I change pan behavior from the left click to right click permanently, using TrackOverlay or ExtentOverlay?
Thanks.

Hi George,

If that will works for whole map, it should be contained in the ExtentOverlay. But it looks we don’t have an API to set the pan mode by right button.

If you want to make that works for trackoverlay, please refer this topic: Panning while in trackmode

And as below is a “hack” way to support right button pan:

public class MyExtentOverlay : ExtentInteractiveOverlay
{
    protected override InteractiveResult MouseDownCore(InteractionArguments interactionArguments)
    {
        if (interactionArguments.MouseButton == MapMouseButton.Right)
        {
            interactionArguments.MouseButton = MapMouseButton.Left;
        }

        return base.MouseDownCore(interactionArguments);
    }

    protected override InteractiveResult MouseMoveCore(InteractionArguments interactionArguments)
    {
        if (interactionArguments.MouseButton == MapMouseButton.Right)
        {
            interactionArguments.MouseButton = MapMouseButton.Left;
        }

        return base.MouseMoveCore(interactionArguments);
    }

    protected override InteractiveResult MouseUpCore(InteractionArguments interactionArguments)
    {
        if (interactionArguments.MouseButton == MapMouseButton.Right)
        {
            interactionArguments.MouseButton = MapMouseButton.Left;
        }

        return base.MouseUpCore(interactionArguments);
    }
}

winformsMap1.ExtentOverlay = new MyExtentOverlay();

Regards,

Don

Thank you Don, I have already tried this, as well as the example above. It works but left click does not stop listening the event for pan, and things get messy while zooming out with Shift+right click. The problem is that left click is the most common event and things get complicated when you try to make pan command transparent through other events like selecting with left click etc and it would be very convenient if panning was listening to right click. I am finally using MapPanMode to get pan out of the way when is not needed.
Regards

Hi George,

I am glad to hear you find a solution for your scenario. It looks we cannot implement disable left pan and move that function to right click for desktop edition, but I think our developer will looks into this and see whether this can be get enhancement in future.

Regards,

Don