Open optim-ally opened 2 months ago
I feel like a good solution to this would be to drag the piece if the mouse was directly on the piece and drag the board otherwise.
Essentially, yes, but we need to be careful with the details. For example, if the board is zoomed out far enough then the mouse may be on top of multiple pieces.
Another issue is whether we consider the mouse "on" a piece if it is in the same square or if it actually needs to be inside the rendered shape of the piece. If it's the latter then cosmetic changes to the board and pieces could affect playing experience by making pieces harder or easier to move. I don't think that should be the case.
- if the board is already moving (e.g. it has remaining momentum from being dragged), then drag the board
When dragging the board with the mouse and letting go, it no longer has momentum, it stops immediately. So it can't be thrown in this manner.
if the board is zoomed out far enough then the mouse may be on top of multiple pieces.
The coordinates of the mouse is a single point, so it can never technically be over multiple pieces, at least in the code. But at that zoom distance clicking and dragging probably shouldn't be selecting a piece anyway, the user probably intends on moving the board.
I feel like a good solution to this would be to drag the piece if the mouse was directly on the piece and drag the board otherwise.
I like this solution and I have actually thought this before! I personally think this is the best solution. But it can be tested!
When I check out Lichess.org's mouse controls, they also have click to select, and click-drag as well! We should have both. Should have thought of that when I was making the first release!
When dragging the board with the mouse and letting go, it no longer has momentum, it stops immediately. So it can't be thrown in this manner.
I'm planning ahead to when we have #23 😛
You pointed out on that issue that scrolling with W,A,S,D already gives the board "momentum". In that case, I think piece dragging should be disabled until the board has come to a halt.
Dragging the board is a new kind of user interaction in infinite chess vs 8x8 chess. It makes the familiar action of dragging pieces in online chess problematic. I tried several time to drag pieces in infinite chess before remembering that it didn't work like that, but perhaps it could!
We could introduce ways to explicitly choose "piece dragging" or "board dragging", like right clicking or holding down a particular key, but I expect most users won't bother with those.
I propose the following logic for handling "drag" interactions:
This might need to go through several iterations if it's going to work, but what are initial thoughts?