Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pieces drop through to window beneath #12480

Open
riverwanderer opened this issue Jul 20, 2023 · 7 comments · May be fixed by #13875
Open

Pieces drop through to window beneath #12480

riverwanderer opened this issue Jul 20, 2023 · 7 comments · May be fixed by #13875
Assignees
Labels
bug Something isn't working
Milestone

Comments

@riverwanderer
Copy link
Collaborator

riverwanderer commented Jul 20, 2023

Observed in Vassal since v3.2.17 (at least). Demo on MacOS but occurs on other platforms, I believe.

May relate to #9517 but has different symptoms from the ones described in the associated replies on the original forum post.

The attached video demonstrates the issue as experienced in the case of dragging a card from a deck into a private window. The fault is seen in any of the Commands & Colors modules. To replicate the video, use the Commands & Colours: Medieval module. Open a scenario as Solitaire. Open a hand window and position it over the board, as shown in the video. Now drag cards from the draw deck into the window, attempting similar drop positions to those where the fault is trigger in the video.

To a point in the forum thread - this fault can be reproduced regardless of whether the top left hand corner of the private window is over a piece or not.

Fault as generally experienced by C&C module users (card draws 2 & 5 show the fault occurring):
https://github.com/vassalengine/vassal/assets/58135975/e8541cdd-2348-447d-9e4f-8bf5fba0b293

Further demo to follow.

@riverwanderer riverwanderer added the bug Something isn't working label Jul 20, 2023
@riverwanderer
Copy link
Collaborator Author

riverwanderer commented Jul 20, 2023

A minimal demo module for Vassal v3.7: CCNdragBugDemo.zip
To start, open "Drag & Drop Bug" from the File menu and follow the instructions in the Chat log.

The demo manifests the issue in two modes, depending on the role you choose: "<observer>" or "Player", shown in the attached videos.

  1. Video of <observer> mode - drag attempt should fail (window is visible but not accessible). However, after failing, the piece then moves to another main board position under the Target Window, notice that the cursor is returned to the original piece position however, as normal:
    https://github.com/vassalengine/vassal/assets/58135975/a48c54db-86fc-418c-a6c1-cab5c8b562bd

  2. Video of Player mode - in fault condition the piece disappears (1st and 3rd drag operations, there is an UnDo between each drag):
    https://github.com/vassalengine/vassal/assets/58135975/5a7e878b-4a20-44a3-a5c1-a634d6c9993b

@uckelman
Copy link
Contributor

uckelman commented Apr 9, 2024

@riverwanderer
Copy link
Collaborator Author

Examining the manifestation of this issue in Commands & Colors: Napoleonics within PieceMove.java, I observe two particular cases that occur when a card is dragged from a deck on the Main Map to an overlying Player Hand window ("Allies Hand").

In the first form, the underlying map ("Main Map") is pointed to by "map" and that is where the piece ends up.

In the second form, the "map" variable points to the overlying - "Allies Hand" as expected - even up to the point of the snapTo() method being completed. However, the piece may still end up on Main Map. In other cases where the map variable points to Allies Hand, it ends up there as intended.

@riverwanderer riverwanderer self-assigned this Feb 25, 2025
@riverwanderer
Copy link
Collaborator Author

Monitoring map before and after performDrop(), it is either both "Main Map" (the underlying window) or "Allies Hand" (the target, overlying window).

I notice that if I turn on the Vassal Debug window to display the cursor's X/Y coordinates, the cursor gives me the Player Hand's offset X/Y, when positioned over that window. However, if I am dragging a card, the offset displayed continues to relate to the main map.

@riverwanderer
Copy link
Collaborator Author

Through debug output to monitor calls to performDrop(), it seems that some drops are intercepted first by the Main Map, whereupon the card is dropped there. Once this happens a subsequent performDrop call when the map is set to "Allies Hand" has no effect.

@riverwanderer riverwanderer linked a pull request Mar 1, 2025 that will close this issue
@riverwanderer riverwanderer linked a pull request Mar 1, 2025 that will close this issue
@riverwanderer riverwanderer added this to the 3.7.16 milestone Mar 1, 2025
@riverwanderer
Copy link
Collaborator Author

riverwanderer commented Mar 1, 2025

Further investigation demonstrated that the underlying issue is not related to map overlays but rather to a synthetic (?) event - one generated with a ClickCount of zero - that Vassal allows through to the mouseReleased() handler in PieceMover(). PR #13875 attempts to address this in canHandleEvent() by only allowing a ClickCount of 1 (before anything less than 2 was allowed).

@cholmcc
Copy link

cholmcc commented Mar 3, 2025

Hi,

Just tried the CCNdragBugDemo.zip (remember to rename it to CCNdragBugDemo.vmod) with my installation:

OS Debian "sid" GNU/Linux
Java openjdk version "21.0.6" 2025-01-21 openjdk version "25-ea" 2025-09-16
VASSAL 3.7.15

and I cannot reproduce the problem. Perhaps the observed bug is related to this bug in OpenJDK? I rolled back to JRE version 11.0.26, and still cannot reproduce the problem. My DPI is 96x96. I tried moving the VASSAL module main and hand windows, around, and also make the windows smaller, larger, zoom, etc. All to no avail - I cannot reproduce the bug.

Yours,
Christian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants