Skip to content

A prototype for clickable maps#13916

Open
riverwanderer wants to merge 3 commits into
vassalengine:release-3.7from
riverwanderer:release-3.7-actionClick
Open

A prototype for clickable maps#13916
riverwanderer wants to merge 3 commits into
vassalengine:release-3.7from
riverwanderer:release-3.7-actionClick

Conversation

@riverwanderer

Copy link
Copy Markdown
Collaborator

Pilot implementation of this idea.

Includes console logging code.

@riverwanderer riverwanderer added the enhancement New feature or request label Mar 27, 2025
Comment on lines +2046 to +2048
// FIXME - incorrect zone found at some points (non-rectangular shape?). Also, why not finding some zones.

final Point mp = scale(p, 1 / activeMap.getZoom());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to scaling you need to apply a translation for the top left visible corner of the map. It works fine when the map is fully zoomed out, but once zoomed in it reports the wrong ones.

mouseReleased may not be the best event to hook. This event fires on control-click, shift-click, dragging a stack into the zone, click drag and release of the mouse and maybe others. The user might try to multiselect a number of counters with a bounding box, which should not generate a zone click event. Untested and just guessing that mouseClick might be a better option.

For a clickable zone there should be some feedback to the user that the zone is the active control much like pressing on a button control. That would mean adding some effect to the zone on mousePressed. But then possibly cancelling that on a mouse drag?

In my module there are both convex and concave zones. As long as the map was fully zoomed out the zone selection was pretty good. Because zones may not perfectly align with the underlying bitmap, a dead band around the zone edges would be nice, but not easy to implement. Although if there is a visual effect, like shading the zone on mouse press, it would be obvious which is the selected zone.

Something else to consider: if the user inadvertently clicks on a zone, how do they cancel out of it?

This is an interesting start but there's a lot more involved to make it a workable feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants