Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

DragToScroll - Universal Drag & Fling/Flick Scrolling


  • Please log in to reply
210 replies to this topic
airblaster
  • Guests
  • Last active:
  • Joined: --
This script is great!
Just switched to Windows 7 64-bit, so I can't use MouseImp anymore.

Is there any way to use buttons other than the right mouse button?
I'm using a Wacom graphics tablet, so I'd prefer using the left mouse button (i.e. just dragging the pen across the tablet, without pressing any other button).

cheek
  • Members
  • 71 posts
  • Last active: Jun 21 2014 03:24 AM
  • Joined: 01 Apr 2009
For all those interested, changing the button DragToScroll is activated on is relatively easy. There are a few gotchas though--I'll mention a few below, so choose your key carefully. I have not tested this with anything but RButton.

To change the hotkey, you simply need to:[*:q4kwvare] Update the two hotkeys in the hotkeys section[*:q4kwvare] Update the DragSkip label to send the appropriate key
1. The hotkeys
Straight forward AHK hotkey scripting, simply find both of the following, and change them to your desired hotkey

RButton::
RButton Up::

2. DragSkip
DragToScroll overrides default behavior for the selected button, so to not interfere & that button to behave normally, the key must be "passed through" by the DragSkip routine, if a click-release (rather than a click-drag) is detected. This is also straightforward. Change the line to send whatever hotkey you chose:

Click Right



For LButton, I tested this briefly, by changing the following, and at a cursory glance it worked fine
LButton::
LButton Up::

...

Click Left

However, LButton is probably generally a bad choice for this kind of script. You will have trouble with double-click; it's probably not something you want to override. Try either disabling detection, or setting the action to simulate a double-click. You will also override the 'click-drag' action (obviously), which is also already used for selecting lines of text, etc.



edit
this is no longer relevant. To change the binding key, simply set the Button variable in app settings.

guest3456
  • Guests
  • Last active:
  • Joined: --
just saw this script, gonna try it out. sounds great because my mouse has no scroll button

guest3456
  • Guests
  • Last active:
  • Joined: --
is there a flag to set to invert the up/down scrolling?

for example, currently, rbutton+drag_up will scroll the document DOWN the page. how can i change it so drag_up will scroll UP?

airblaster
  • Guests
  • Last active:
  • Joined: --
I tried to adapt the script to LButton usage.
Replaced several instances of RButton with LButton. Replaced a function call to "click right" with "click left". And disabled UseRButtonDoubleClick.

That way, most functions seem to work. There is one major problem left: in order to trigger a left click (and thus a double click), the LButton may only be pressed for a very short amount of time.
Instead, I'd prefer for a left click to be registered as a click upon release of the button, if no scrolling occurred since LButtonDown.
Also, I'd prefer scrolling to only occur if the mouse coordinates changed more than a certain (configurable) threshold, because clicking using a graphics tablet pen always causes some minor mouse movement.

I wonder how this could be implemented?

airblaster
  • Guests
  • Last active:
  • Joined: --
Oops... just noticed part of the functionality is already there: DragThreshold is what I was looking for.
That would mean the only thing missing is triggering LButton if no scrolling occured.

cheek
  • Members
  • 71 posts
  • Last active: Jun 21 2014 03:24 AM
  • Joined: 01 Apr 2009
It sounds like what you want is DragDelay and/or DragThreshold.

The delay determines how long you have to hold the button down before it is treated as a drag & suppressing normal behavior. If you release the button before that time (in ms), drag is not activated, and the normal click is sent.

The threshold is related to the scroll behavior, after it has been delay-activated. It basically sets how much you need to move the mouse before the document is moved.

Do those give you what you need? What problem are you having?

Having thought about it a bit more, its probably better to simulate a double-click rather than disabling the detection.. You should test both and see which yields better results :)

cheek
  • Members
  • 71 posts
  • Last active: Jun 21 2014 03:24 AM
  • Joined: 01 Apr 2009
I will be posting an updated version soon, which will include tray icons and an "invert" setting for guest3456. Stay tuned!

done!

cheek
  • Members
  • 71 posts
  • Last active: Jun 21 2014 03:24 AM
  • Joined: 01 Apr 2009
I was just noticing that the scrolling is a little fast for your average webpage or document; these windows do not tend to be as long as the files I'm working with regularly (code has lots of lines...) This also sorta hides the momentum on these docs; you've scrolled the whole thing before momentum kicks in!

Here's a little snippet that will let you toggle the speed as fast or slow mode. In my copy I've set this as the double-click action, with a little tooltip. Maybe it'll make it into the next update..
Just paste this code into the RButtonDoubleClick: label to try it out
   slowSpeed := .5
   bSlowMode := !bSlowMode
   
   if (bSlowMode)
   {
     SpeedY *= slowSpeed
     SpeedX *= slowSpeed
   }
   else
   {
     SpeedY /= slowSpeed
     SpeedX /= slowSpeed
   }


airblaster
  • Guests
  • Last active:
  • Joined: --
Thanks for your help, cheek.

As for click detection, I'd prefer if a click would be registered regardless of time, if mouse movement is less than DragThreshold (i.e. either scroll or click).

Also, is there a way to exclude certain applications that use their own drag routing (e.g. Acrobat Reader, Opera) from being handled by the script?

guest3456
  • Guests
  • Last active:
  • Joined: --

I will be posting an updated version soon, which will include tray icons and an "invert" setting for guest3456. Stay tuned!

done!


excellent thanks!

is there also a way to get a single normal right click to get the right click popup menu in conjuiction with the dragging?

cheek
  • Members
  • 71 posts
  • Last active: Jun 21 2014 03:24 AM
  • Joined: 01 Apr 2009

As for click detection, I'd prefer if a click would be registered regardless of time, if mouse movement is less than DragThreshold (i.e. either scroll or click).


I cant really wrap my head around how you'd do a distance only filter, but I played around some with filtering by drag threshold before, and ultimately decided that it made more sense to simply delay the drag.. Filtering by distance sorta interfered with the experience. I'd start by trying to bump up the DragDelay to allow more time for the click-release to happen. That will probably yield better results

You could play with the Delay and Threshold settings, add a simple check (below) The problem with this is that it will interrupt your drag as soon as you stop/slow dragging. You may be able to work around this by adding another state to DragStatus, that is set before you actually start dragging, and stop the drag only if its below threshold AND youre in the CHECK status.

if (abs(DiffX) < DragThreshold)
{
  GoSub DragSkip
  Return
}


Also, is there a way to exclude certain applications that use their own drag routing (e.g. Acrobat Reader, Opera) from being handled by the script?


I have considered an addition to this project that would write out user settings to an external file that would override the script defaults, and to allow per-application settings, with which you could set an 'ignored' list. Until that time, you could work in a pretty simple check for the target application, and simply DragSkip. For example, paste below MouseGetPos in (DragStatus == DS_NEW), around line 315. This simply checks the active process and forces the code to skip, rather than start the drag.

    ; MouseGetPos gets the window ID. 
    ; Use the id to fetch process name, window class, title, etc, and filter
    WinGet, procName, ProcessName, ahk_id %WinHwnd%
    if (InStr(procName, "acrobat.exe"))
    {
      GoSub DragSkip
      return
    }

That said, most applications that have their own dragging are done only when using the drag tool, and do not have momentum or acceleration. I was actually just using this today reading a long acrobat doc; Works great!


is there also a way to get a single normal right click to get the right click popup menu in conjuiction with the dragging?


Not sure what you mean here, this should be covered by the script already; it's designed only to activate only if you click-hold and move the mouse. If you click-release, it should send the normal right click for you. If you're having trouble getting a normal right click, try increasing the DragDelay variable (200-500 maybe?) to allow yourself more time to click-release. ...or just click faster! :)

guest3456
  • Guests
  • Last active:
  • Joined: --

If you're having trouble getting a normal right click, try increasing the DragDelay variable (200-500 maybe?) to allow yourself more time to click-release. ...or just click faster! :)


that was it! thanks

  • Guests
  • Last active:
  • Joined: --
I just found this, wanted to say thanks! Very cool. I never use the scrollbars or mousewheel anymore.. feels faster. I like the tray icon :-)

DarKcyde
  • Guests
  • Last active:
  • Joined: --
First of all, thank you so much. I've been looking for a good way to do this for a while now, since using Scrollbar Anywhere in firefox. MouseImp wasn't bad, but limitted, and ScrollNavigator was buggy as hell too.

1.

it's designed only to activate only if you click-hold and move the mouse. If you click-release, it should send the normal right click for you.

Exactly. Right now, if you click-hold, and don't move the mouse it still captures your right click. For example, Right-hold+Left click (like a rocker gesture) doesn't work. If there's no mouse movement, the right click should always happen.

2.
How about a quick-disable key? Like hold Ctrl to temporarily allow right-click dragging files in explorer.

3.
Icon doesn't work in Win7 x64, using Autohotkey_L x64. I still have a Green H.

4.
Per-application scroll selection would be nice. So you could specify Wheel-key for apps that need it, but use Wheel Message elsewhere.