wieslawsoltes / PanAndZoom

Pan and zoom control for Avalonia.
http://wieslawsoltes.github.io/PanAndZoom/
MIT License
337 stars 44 forks source link

Enable panning on left mouse button down #14

Closed zubairrana closed 7 years ago

zubairrana commented 7 years ago

By default panning is enabled on right mouse button down but the standard of using panning or dragging is through left mouse button down. Can you please guide how to shift this control from right button to left button. @wieslawsoltes

Thanks

wieslawsoltes commented 7 years ago

The default depends on application and this control is used in drawing software where right mouse button is used for panning. I will take a look how to enable this to be configured.

clembu commented 7 years ago

@wieslawsoltes when you look at it most often there is a "pan tool" which pans on held left clicks. This tool concept is outside of your scope, sure, but as long as "CanDrag" and "CanZoom" are togglable, it would be beneficial that the inputs for dragging and zooming can be configured at will

wieslawsoltes commented 7 years ago

Sure I will make them configurable.

zubairrana commented 7 years ago

@wieslawsoltes i have found your code from stackoverflow with panning on left mouse button down. Here is the link: https://stackoverflow.com/a/6782715/6482266

I am working on this code to combine it with the nuget package to fulfill my requirements. Now the only problem is that this old code does not contain few keyEvent methods like Fill(), AutoFit() etc. I am trying to figure out these also. Hopefully next version will cover all these issues.

BTW Thanks for such a great work.

wieslawsoltes commented 7 years ago

@zubairrana This issue is fixed on lates master. Use PanButton property to set desired pan button:

/// <summary>
/// Describes mouse button names.
/// </summary>
public enum ButtonName
{
    /// <summary>
    /// The left mouse button.
    /// </summary>
    Left,

    /// <summary>
    /// The right mouse button.
    /// </summary>
    Right,

    /// <summary>
    /// The middle mouse button.
    /// </summary>
    Middle

}