Preventing unwanted selections and drag 'n drops?

The mouse is hypersensitive in Vassal. There is essentially no tolerance on the drag n’ drop function so even the slightest cursor movement during a mouse click moves a piece. I’ve also observed many instances when Vassal unexpectedly retains the selection of a Piece. Sometimes a Piece from an entirely different window, that was previously selected, gets dragged along for whatever action I’m presently performing on another piece. On rare occasions, I’ve even witnessed impossible behavior as a result of these sticky selections from who knows how or when. For instance, I have a card which is not playable as an event (logic is definitely sound), that got played as an event when it was inadvertently selected and played simultaneously with a whole deck of cards. I read the log 5 times to make sure I wasn’t seeing things. This stuff seems rare, but I could see it completely undermining a long game if its an important card and somebody doesn’t notice it in time to perform an undo. I can’t imagine there is any way to reduce the sensitivity of the mouse, but I figured I’d ask anyway. More realistically, is there a way to force pieces to be deselected using the Selected property? My module doesn’t have stacks, so I’d do away with ever being able to select more than one piece if that would reduce the mouse hypersensitivity. Lastly, I haven’t been able to figure out what the difference is in the Does Not Stack trait between a piece that “moves normally” versus “only when selected”. Maybe if I knew, that might be helpful?

1 Like

Various thoughts:

  • Yes Vassal does a very poor job distinguishing between “a click”, “a drag”, and “a nothing”. Basically bad mouse heuristics. Haven’t dug in to see if that’s java-bound or something that can be tweaked in the engine.
  • I have all my “move reporting” set with a filter of OldLocationName != LocationName so that I won’t get chatlog spam every time somebody accidentally moves things “one pixel left” (usually when they were trying to double click).
  • Decks aren’t supposed to band-select, but if you already have a card/piece select and then do a shift+drag it will catch them (BUG, obviously, can’t remember if I’ve already written that one up or not).
  • I have written a “Deselect” custom class if you want it. Lets you send a keystroke to a piece and force it to be deselected. I don’t think Deselect is scheduled to be an out-of-the-box feature until Vassal 4.
  • Does Not Stack has the option to make selecting a piece require e.g. holding the Alt key. If you combine that with “moves only when selected” then if you attempt to “click and drag” such a piece without the Alt key held down it won’t move. That’s the only difference as far as I can tell.

Brian

This sounds very interesting. Can you describe how you use it in your modules, and what benefits you get from using it?

In For the People there are various special units, Armies, that while moving around can drop off and pick up “strength points” which are other units that are subcomponents of armies but can move independently (e.g. as a corps or a division). So when moving an army around it is common to move it a space, drop something off, move another space, pick something up, etc, etc.

And so I initially made commands e.g. “PageDown” button with an army selected dropped off a strength point (and various other commands like Ctrl+Pagedown to drop off 6 SP which is the strength of a full corps). But I discovered that when you do a Place Marker trait (which is how I was doing the dropoff), Vassal adds the dropped-off marker to the current selection. So you’d drop something off, and then you’d drag your already selected army counter to the next space, and it would turn out the SP you’d just dropped off came with you – NOT what I wanted.

So now in the “keystroke-on-placement” of the Place Marker trait, I now have a keystroke that (at least among other things) activates my Deselect trait, which then removes the newly placed unit from the current selection. So that now when you drop off a strength point, e.g. with PageDown, and then drag the Army to the next space, the SP you dropped off stays there.

Brian

Interesting. I have never noticed that. Does it very depending on whether you place the marker “on the stack”, “on the piece”, “under the piece”? Or whether the place marker is triggered by menu or map trigger? I’m pretty sure that right-click place marker “on the piece” where both pieces have “does not stack”, does not result in the placed marker being selected, but I will have to test that.

I’m not sure about the exact case you mention, but both of my pieces need to be stackable (although they are in different layers so do not stack together themselves). But I’m not sure what happens when two does-not-stack’s do this interaction – but I tried all sorts of combinations with my pieces and never had any luck until I wrote the Deselect.

That would be great if you could share your Deselect. Is it in your For The People module? Can it be dropped in as-is or does it need some modification? I haven’t added a class yet.

Also, on a slightly related note, any ideas on how to suppress drag-n-drop from a Deck? I’d prefer if players could only click on the Global Hotkey button I created to draw a card. I have some logic that counts card draws that is getting complicated because I need to account for drawing a card when it is not allowed or players not dropping it far enough from the deck so that it does not go right back in it. I need to retain drag-n-drop TO the deck, but don’t want it FROM the deck. Sadly, it seems you can only suppress the wrong one for my purposes. I tried making the deck 1 pixel by 1 pixel but it ignores that size and uses the card size. I also tried adding a dummy empty deck on top of the actual deck to block, but then Return to Deck sends to the dummy deck unless it is behind the real deck, and thus not blocking the drag ‘n drop. Lastly, "Restrict adding counters by Drag n’ Drop" with the LocationName or OldLocationName trait does nothing - so it seems dragging from a deck back into the same deck is not considered “adding a counter by Drag 'n Drop”.

PS It makes sense that nothing happens if you Restrict adding counters by Drag n’ Drop by OldLocationName. Where else is it supposed to return to? The dummy empty deck seems to be a total non-starter. It blocks returns to the real deck, but doesn’t prevent draws from it. I guess my last option is to explore is cards in a deck are stacked by layers…

To prevent people from dragging/dropping cards from/to a deck, I place the deck above or to the left of the map. It’s invisible but functional via buttons. I do this all the time.

Likewise, but that’s not the issue here. I need people to be able to drag cards back to the deck, but do not draw from them so just hiding the deck won’t work. I suppose I could place the real deck off-map and just have a dummy deck for returning cards that automatically forwards to the real deck.

Deselect IS the one in For the People. But since it requires the CommandEncoder stuff to “remember” the traits, and that supports another custom trait too, it’s not a straight drag and drop from the module.

Instead, go to this link:
brianreynolds.com/files/Deselect/

  1. Pull out the three .class files (including the one with the weird name)
  2. Open up your Module as a zip, and create a subdirectory “Deselect”
  3. Drop all 3 files in that subdirectory.
  4. Open your module to edit.
  5. Browse to some piece/prototype you want to add the Deselect trait to
  6. Instead of picking a trait from the list click the “Import” button at lower left
  7. Fully qualified name should be Deselect.Deselect
  8. Once you’ve added it, look at your trait list and it should be there to edit.
  9. It has a very simple little editbox, but basically whatever keystroke you put in, if you send it that keystroke, it will get deselected.

Brian

Why drag? Why not right-click cards back to the deck?

This is about system resilience, and to borrow Brian’s term, heuristics. One of my principal playtesters is a Baby Boomer who is technology challenged - basically the core demographic for wargaming. If there is a way to break it, he seems to inadvertently find it. Perhaps if I get Brian’s Deselect class working, I will reevaluate how I’m implementing this, but can we just keep the assumption that the most desirable method for players to manipulate this deck is to click to draw and drag to return?

Thank you! I’ll let you know how it goes. This could be very helpful for this issue.

What does being a baby Boomer have to do with anything? I am a baby boomer myself, and I find this damned insulting.

Indeed. I find that a lot of people from the latest generation is technically challenged. They might know how to swipe on their touchscreen phones and how to use the mouse to point and click at things, but all too often, this is all they know. I’m in IT, and we have a demographical pyramid - there are much fewer young professionals than there were in my time some 15-20 years ago, and they are less capable too. It’s almost as if touchscreens have spoiled a whole generation.

Sorry no offense intended. I’m not ageist, just don’t have much of a filter.

Each generation has its tendencies so I was framing the context. That was the intent of my comment but I see how it came off as ageist. The younger guys I work with poke fun at me all the time because I’ve been programming for over 35 years and am most comfortable when using a command line. Ex. when the pandemic first broke out, they joked I should relocate to New Jersey because they desperately needed COBOL programmers. My dad barely can use a mouse, yet he was a principal engineer at UNIVAC, designed the original Computer Science curriculum at his university, and up until his retirement, was consulted as an expert witness in the CS field. It’s all relative…

I installed this and it’s working great. Combined with my {Selected==true} trick for Mark As Moved, I think I’ve got Vassal working about as good as I can without delving into my own custom classes. Thx.

I investigated this further and it is indeed the only difference. Kinda odd that someone put in the effort to allow barriers for intentional actions (right-clicks) while leaving full sensitivity to accidental ones (drag 'n drop) and not the other way around. Oh well.