Pan using middle mouse button?

Started by ruland, September 21, 2017, 09:34:13 AM

Previous topic - Next topic

ruland

Another question about ImageBox:

As it is now the image can be panned by moving the mouse pointer while pressing the left mouse button. Is it possible to change the default setting, so that holding the middle mouse button pans the image, instead of the left one (which I'm using for a different functionality)?

Richard Moss

Hello,

It's really strange, but I've spent years ignoring the fact that the mousewheel is clickable and used by many applications for a free-form scroll/pan. I've mainly only ever just used it as a wheel. So it never occurred to me to build this into ImageBox.

However, it does make perfect sense to allow this (and is probably much more useful given that the left click is often used for other things). I'll have a look into introducing this.

Thanks for the suggestion!

Regards;
Richard Moss
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.

ruland


ruland

Any news on this?

(Don't mean to appear impatient, just curious. My program would be so much better with that change implemented... :) )

Richard Moss

In a word, not yet. Most of my time gets eaten by WebCopy and when I do get a free moment I try and write a blog post instead or focus on something else that is broken. Things like ImageBox which are working fine and ticking along nicely don't get much time for TLC. Not to mention Visual Studio 2017 is playing havoc with my build process for packages and I just haven't got the energy to look at it.

I need to investigate a high DPI issue with the Color Picker controls, and I've still a minor mountain of issues with WebCopy to resolve but it will probably do me good to do something else - I'll do my best to get onto it soon. Soonish. With caveats.

Thanks for the understanding!
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.

Richard Moss

Hello,

There's a new alpha package available which implements middle click panning. As it's an alpha, you need to enabled "pre-release" packages to see it via NuGet.

The source is available in the FreePan branch on GitHub - it won't be merged to trunk until I'm happy with it.

Out of the box, free pan using the middle mouse button will just work (including if AutoPan was previously set to false). However, you can use the new PanMode property to configure if the left, middle or both buttons can be using to initiate panning. This replaces the AutoPan property which has now been marked as deprecated.

I also added a property named AllowFreePan. When set to true (the default), clicking with the middle button will allow you to move the mouse around and the control will pan. If false then it behaves the same as the left button pan - you have to hold the mouse button down in order to pan.

Let me know if this works for you.

Regards;
Richard Moss

PS: Free pan will only trigger is there's something to pan. If the image fully fits in the control, then nothing will happen.
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.

ruland

Wow!

With these settings:

            imgMap.PanMode = Cyotek.Windows.Forms.ImageBoxPanMode.Middle;
            imgMap.AllowFreePan = false;

I can perfectly pan the image using the middle mouse button.

(The new properties do not appear in the properties window yet, though.)

Thank you very much!

Richard Moss

Quote from: ruland on November 25, 2017, 04:07:52 PM
(The new properties do not appear in the properties window yet, though.)

I just tested and they appear fine for me - they are both located in the Behaviour category. Trying performing a Rebuild of your solution then re-open the form designer where you're using the control. Also make sure that if you have multiple projects in your solution referencing ImageBox that you updated the package for all of them.
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.

ruland

Restarted VS and they are now there! Thanks.  :)