josm icon indicating copy to clipboard operation
josm copied to clipboard

JOSM #22378 - Preview object properties on mouse hover

Open Woazboat opened this issue 3 years ago • 1 comments

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)

josm_mouse_hover_object_preview

Woazboat avatar Sep 16 '22 17:09 Woazboat

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.

Woazboat avatar Sep 16 '22 17:09 Woazboat

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.

Woazboat avatar Oct 05 '22 08:10 Woazboat

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
        }
    }

tsmock avatar Oct 05 '22 14:10 tsmock

I added a setting that controls whether a selection should override the hover preview (default is to always show the selection).

Woazboat avatar Oct 05 '22 19:10 Woazboat

Are there any other remarks from your side? Otherwise I think this is good to go.

Woazboat avatar Oct 11 '22 10:10 Woazboat

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).

tsmock avatar Oct 11 '22 13:10 tsmock

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)

tsmock avatar Oct 17 '22 14:10 tsmock