los thread toggle

In VASL, we extend the VASSAL los thread to add some custom functionality.

Normally players click the los thread button or use the hotkey (F10 in our case) to enable the los thread, then draw the thread and, when finished, click on the map to clear the los thread.

At present, clicking on the map is the only way to clear the los thread. Neither clicking on the button nor using the hotkey will turn off the los thread.

Can we have the los button work as a toggle as many other buttons do? Is this how the VASSAL los thread works? If not, then we have obviously done something in our custom code to cause this change (I cannot see anything that does this but I may be missing it).

We are also experiencing freezing problems when both players have the los active at the same time. We are going to try and disable los on remote machines whenever a local player activates the thread to see if we can stop this freezing problem. Any advice on how best to do that? Can we send a command to disable the button?

Hi Doug,

I don’t know much about LOS threads because they don’t figure in any of “my” modules, but I did load up a few modules today and verified that in 3.5.3, 3.4.12, and 3.2.17 (in other words, since the dawn of time), that the functionality you describe (“clicking on the map is the only way to clear the los thread”) is the standard VASSAL functionality.

If you wanted to try to extend/improve that functionality you could examine the current code in the mousePressed (and possibly mouseReleased though that seems more like a chamber of horrors) and find the relevant logic that makes clicking the map clear the thread. You could then attempt to introduce that into the “launch()” method – so-called because the toolbar buttons are considered “launch buttons” for their respective components – it looks like perhaps in the opposite case of the current “if (!visible) …” that activates the feature in the first place, you could put some cancelling logic. But I DON’T know what all that “persisting” stuff relates to – remember I was Today Years Old when I tried my very first VASSAL LOS thread :slight_smile:

Brian

Thanks Brian

Very helpful.

BTW, I have only just (like yesterday) sorted out persistence. It relates to how long the drawn string remains visible (until the mouse is released, until the los check is cancelled by clicking the map, etc). It does not appear to be a source of our problems.