josm
josm copied to clipboard
JOSM #22378 - Preview object properties on mouse hover
https://josm.openstreetmap.de/ticket/22378
Show tags and relation memberships of an object in the properties dialog when moving the mouser pointer over it (similar to iD).
Can be enabled/disabled via settings (enabled by default)

Object selection state could be cached so that ui updates are only triggered when there are actual changes. That's not in there at the moment but could be added if there are performance problems.
I just noticed a minor issue: The preview is also displayed and updated when the data layer is hidden and the hovered objects are not actually visible.
Take a look at Layer.VISIBLE_PROP in conjunction with implementing a PropertyChangeListener.
Example:
@Override
public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) {
// Remove previous listener (order matters if we are somehow getting a layer change event switching from one layer to the same layer)
if (e.getPreviousDataLayer() != null) {
e.getPreviousDataLayer().removePropertyChangeListener(this);
}
// Register a listener
if (e.getSource().getEditLayer() != null) {
e.getSource().getEditLayer().addPropertyChangeListener(this);
}
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (Layer.VISIBLE_PROP.equals(evt.getPropertyName())) {
boolean isVisible = (boolean) evt.getNewValue();
// Update state
}
}
I added a setting that controls whether a selection should override the hover preview (default is to always show the selection).
Are there any other remarks from your side? Otherwise I think this is good to go.
Good to know. I'll take a look at it again today. I won't merge it until Thursday at the earliest (we did a hotfix last Friday, and I'm waiting to make certain that we don't have any other bugs that affect many users, as counted by duplicate tickets).
In 18574/josm:
Fix #22378: Preview object properties on mouse hover (patch by Woazboat, modified)
Show tags and relation memberships of an object in the properties dialog when moving the mouser pointer over it (similar to iD).
Can be enabled/disabled via settings (enabled by default)