drawpile / Drawpile

A collaborative drawing program
http://drawpile.net/
GNU General Public License v3.0
1.05k stars 133 forks source link

Layers change/chat shows pervious text with arrow keys #1115

Open vipperz opened 1 year ago

vipperz commented 1 year ago

This happens in every version of Drawpile (stable/beta/continuous).

When I click on a layer, leave the curser over the layer dock, and try to move around the canvas with the arrow function keys, the selected layer changes (when using UP and DOWN) until I move the curser over to the canvas. It's something that happens often if I'm looking between layers and hiding the view of one or more for a moment. It's been easy to start drawing on the wrong layer from it.

There's also a similar affect when you use chat and you try to use the arrow keys (UP and DOWN) it'll bring back what you sent previously into the typing line, instead on it targeting the canvas. You have to physically click on the canvas or a scroll bar for the canvas view to start moving again with arrow keys.

askmeaboutlo0m commented 1 year ago

Hmm, that's "normal" behavior on the surface of it. No other control gains focus just by hovering the cursor over it, the canvas is no different, you have to interact with it in some way for it to gain focus. However, I can see how that's an issue, especially if you don't have a pen with a middle click that you can quickly tap on to switch the focus to the canvas.

Looking at how Krita does it, it seems that they have some kind of heuristic on their canvas that will switch focus to it after the cursor has been over it for a few seconds and then moves again afterwards. Although I don't think that works too well, it's still very easy to get focus stuck there.

So I don't really have a clear idea how to solve this. We can't just focus the canvas the instant your cursor touches it anyway, since it's very easy to move your cursor across the screen as you put your pen away to type. What would be somewhat easy to do would be to have some unused key combination that will focus the canvas. For example, double-tapping Alt could be used for it, since that's not involved in anything else.

I dunno, do you have any concrete ideas on how to solve it?

vipperz commented 1 year ago

Even if a pen has a middle click, you would still have to move the pen over to the canvas in order for the focus to be changed. The middle click acts as a second right click when used over the layer dock otherwise.

I was thinking of there being some kind of key or combination myself, if it were a possible solution. Having the option to be able to switch focus is an interesting idea, at least for those who have a hard time keeping onto the layer they're supposed to be on or trying to reduce wrist/arm movements with their drawing hand in general. It would be an appreciated gesture to use.

I wouldn't know any other implication to suggest either, at the moment.

askmeaboutlo0m commented 1 year ago

I've added the aforementioned double-tapping of Alt to focus the canvas, which can be turned off in the tool preferences, as well as a regular "focus canvas" shortcut that's bound to Ctrl+Tab by default. It's in the continuous release, does that work for your use case?

I might still look into doing some kind of guessing if the canvas should be focused based on cursor movement, since that's probably more intuitive, but that's more tricky to get right than just key combinations.

vipperz commented 1 year ago

Yes, it's actually very helpful on my end and hopefully to any others how have the issue as well, once getting used to the shortcuts. Thank you yet again for your assistance. I can't express enough gratitude for all that you've done.

I'd possibly think to look into the movement focus for the chat than how it's been with the Layer dock, unless you mean to have it as a whole UI integration. It does get things thrown off guard when you use chat for a bit, don't click onto the canvas, and try to use shortcut commands. The keys will generally build up on the typing line until you notice it.

askmeaboutlo0m commented 1 year ago

Cool, glad that's helpful. And yeah, the movement thing would be a feature of the canvas to take the focus away from whatever other control might have it, no matter what that control is. Definitely needs some thinking on how to make that work still, since it obviously shouldn't steal your focus unintentionally.