BleuBleu / FamiStudio

FamiStudio NES Music Editor
MIT License
1.6k stars 101 forks source link

Pan on scroll; and add 2-dimensional scroll-wheel support. #16

Closed sirocyl closed 4 years ago

sirocyl commented 4 years ago

I'm aware that you can pan the document by holding ALT and clicking/dragging the pattern editor, but with some input devices, especially laptops, that becomes tedious when editing larger documents.

The tl;dr:

  1. Add X/Y scroll support, for those mice and trackpads that have it and support it, including the Apple Magic Mouse. Scrolling left+right should always pan left or right.
  2. Also add an option to prioritize panning on scroll over zoom on scroll (holding CTRL would switch to zoom mode.)

The backstory:

I generally use a laptop for composition work, a Thinkpad - the model isn't as important, but bear in mind that it has two mouse inputs, which IBM/Lenovo call an "UltraNav", both of which aren't traditional:

  1. A multi-touch trackpad, with a "one-button"/virtual left/middle click design. Like most modern laptops, it has a capacitive trackpad which can operate the cursor, and click, with both taps and a physical press, which simulates a right mouse button click when you tap or press in a certain zone of the pad.
  2. The TrackPoint™ pointing-stick device. Also known as "the nipple" or various less-than-savory terms, it is given three physical buttons - the left and right function as expected, but the middle is special.

The TrackPoint takes priority over the touchpad, if both are being manipulated.

On Windows, as default, the TrackPoint middle button is used to momentarily switch from "pointing mode" to "scrolling mode" for the duration that the button is pressed. It cannot typically operate as a middle-click/3rd mouse button.

When in scroll mode, the Trackpoint acts as an x/y scroll wheel, moving the document or page under the cursor, but not moving the cursor. Depending on how much pressure you put in either direction, it fires many scroll events, which most browsers and page readers smooth out, but a lot of applications either slowly crawl a few pixels at a time, or (in FamiStudio's case) jump around like mad.

The problem:

When editing a FamiStudio document on a laptop, I find myself regularly zooming the page without realizing, and often losing my place in the page, when I mean to scroll/pan the pattern or piano roll view. While it would be more intuitive on a desktop with a proper three-button mouse, on a notebook there's a bit of a usability disconnect there.

The environment:

Lenovo ThinkPad with UltraNav/TrackPoint style 3-button pointing device. Also tested on other laptops with Synaptics brand touchpads/trackpads with multi-finger scroll.

Example:

ezgif com-gif-maker(1)

BleuBleu commented 4 years ago

Hi!

Yes, I've had tons (tons = more than 5 in our little chiptune community!) of people telling me that its impossible to use on a trackpad. The app definitely was not designed with that in mind. To be honest i am quite blown away that people manage to be productive with a trackpad/niplle, but heh, that might just be my lack of skills :)

I'll definitely put that on the list for 2.1.0. You explained the problem very well.

Would you happen to be aware of an app (any, but best would be it if is music-related) that actually has decent trackpad control so I can look at it for inspiration and get a feel for what would be the best solution ?

-Mat

EDIT: Just clicked on the XKCD link haha.

sirocyl commented 4 years ago

To answer your one question: Firefox.

Apologies in advance if the following is a bit disjointed, it's 5AM and I did quite a bit of traveling the night before. Anyway:

Some implementation notes:

the why:

Mozilla Firefox handles scroll and zoom behavior well with trackpad and trackpoint, and would serve as a good model for this. Scroll in either x/y direction scrolls the content; ctrl+scroll performs a zoom.

I've never used FL Studio with a trackpad or trackpoint, so I can't vouch for its handling of either. I just tested Audacity under Linux, and - while it's timeline based, it uses left/right scrolling to scroll forward and backwards through the document, so I wouldn't recommend emulating its behavior. I'm not sure offhand if it handles that better on Windows or not.

The main difference in FamiStudio, is that the major axis - i.e., the one which moves through the document rather than across its parameters - is horizontal in nature. It might be worth considering a settings :ballot_box_with_check: box to swap the scroll axis, so that users with X/Y scroll can scroll natively, but users with Y-only scroll will sweep across the timeline when scrolling, and not up and down the instruments/piano roll octaves.

keep in mind:

BleuBleu commented 4 years ago

Hey Hi!

I finally have to time to look into this. I was wondering if I could use you to test a prototype version of this. I do have 2 laptops with trackpads here, but no "nipple-type" control and I want to make sure not missing anything. Drop me an email at famistudio@outlook.com when you have some spare time. Thanks.

-Mat

mmontag commented 4 years ago

Just dropping by to add 2 cents:

BleuBleu commented 4 years ago

Thanks for the feedback man.

I've been thinking about it and where i am currently heading is to provide a simple "trackpad mode" control scheme in the setting which would swap a few controls :

Scroll bars I'd like to avoid. I draw all my own UI with D3D/OpenGL, i use no widget whatsoever, so adding that kind of stuff is actually a lot more work than it looks like unfortunately. :cold_sweat:

-Mat

sirocyl commented 4 years ago

Email sent.

I also have a mobile Windows XP/Vista/7 device with a resistive (one-point) touch screen and a "plain" pointing device - i.e., no scroll wheel - which I can test usability kinda stuff on.

BleuBleu commented 4 years ago

This was done in 2.1.0, needs to be enabled in the settings (Trackpad controls). Let me know if you have any further feedback.

Incognito357 commented 4 years ago

shift+scrolling on linux still zooms instead of panning (not sure if that was actually added or just mentioned as a possibility)

BleuBleu commented 4 years ago

Have you enabled trackpad controls? Here on my disto it changes the scroll direction.

https://famistudio.org/doc/config/#user-interface-configuration

-Mat

Incognito357 commented 4 years ago

Ah, no I guess I ignored it since I don't have a trackpad. Enabling this option makes the sequencer work as expected, allowing shift+scrolling to pan, and ctrl+scrolling to zoom, but takes away the ability to use the scrollwheel without ctrl held to zoom.

Shift or ctrl scrolling in the pattern editor is not consistent, though. Ctrl+scrolling seems to sporadically change between panning vertically and zooming, while shift+scrolling seems to change between panning vertically and horizontally. I feel like it thinks it hits a boundary of some kind, and prioritizes zooming or panning over the other temporarily, but it's hard to say exactly (it happens in the middle sometimes too). Overall, it seems to prioritize panning vertically over zooming or panning horizontally.

Scrolling normally (without holding ctrl or shift) in the pattern editor has the same issue referenced in https://github.com/BleuBleu/FamiStudio/issues/38, except the 2-tick jump happens for vertical panning rather than zooming (jumping between the extremes of the piano roll octaves).

Overall, using the trackpad option, the sequencer feels much more comfortable to use, but the pattern editor becomes much harder to use due to the inconsistencies (zooming becomes nearly impossible, but panning is still easy enough to use with middle click dragging).

Here I've recorded what happens, since it's a bit hard to explain. I am holding the buttons and scrolling the entire time, and tried to scroll up and down consistently. Sometimes it takes multiple scroll ticks before it responds as well, though that's hard to capture.

shift+scrolling: shift+scrolling

ctrl+scrolling: ctrl+scrolling