Investigating issue #12480, I’ve found that the issue arises because two (or more?) overlapping windows may generate a mouseReleased event from each of the windows from a single physical action. The events are received in the same order as the map windows listed in the buildFile. The first event is fully processed - moving the piece to what is typically the underlying map. Once this happens, the next event in the sequence will have no effect.
At least, that’s what I’ve observed. Here’s a typical log from a single Drag & Drop action:
mouseReleased() executing for: Main Map, event source: VASSAL.build.module.Map$View[,0,0,2279x1083,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=297,maximumSize=,minimumSize=,preferredSize=]
mouseReleased() executing for: Allies Hand, event source: VASSAL.build.module.PrivateMap$View[,0,0,1357x700,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=393,maximumSize=,minimumSize=,preferredSize=]
In this example the PrivateMap (a Player Hand) overlaid the Main Map but the piece was placed on the Main Map.
I’ve considered various ways to detect & workaround this error but without success. A key obstacle is that I can’t find a reliable way to determine if one window lies on top of another on screen.There seems to be no OS-independent solution to that (i.e. in Vassal or Java Swing), at least none that I can find. If this were possible, I’d propose to ignore mouseReleased from an occluded map (I’ve not yet seen an instance of an occluded map generating an event but the overlying map not generating one).
Could there be a solution in the way in which maps handle Drag & Drop events?
If anything jumps out at you from my findings so far or if you have any suggestions as to how I can take this further, please chip in.