Modify

Opened 8 years ago

Closed 8 years ago

#6875 closed defect (fixed)

[Patch-2] Data Layer can be changed after selecting another layer

Reported by: Larry0ua Owned by: team
Priority: critical Milestone:
Component: Core Version: latest
Keywords: Cc:

Description

The bug reproduction steps:

  1. Open JOSM (latest or tested)
  2. Download some area.
  3. Open some GPX file.
  4. In Layers toggle dialog select GPX layer.
  5. Move mouse on some object from data layer.
  6. Try to move that object, change its properties - all works, but should not as we selected GPX layer as current.

Attachments (2)

patch.diff (1.4 KB) - added by Larry0ua 8 years ago.
patch for josm\core\src\org\openstreetmap\josm\gui\MapFrame.java
patch2.diff (3.0 KB) - added by Larry0ua 8 years ago.
josm\core\src\org\openstreetmap\josm patch

Download all attachments as: .zip

Change History (11)

comment:1 Changed 8 years ago by olejorgenb

It actually seems like this is intentional?

From MapView.java

    private void setActiveLayer(Layer layer, boolean setEditLayer) {
// ... snip ...
        /* This only makes the buttons look disabled. Disabling the actions as well requires
         * the user to re-select the tool after i.e. moving a layer. While testing I found
         * that I switch layers and actions at the same time and it was annoying to mind the
         * order. This way it works as visual clue for new users */
        for (Enumeration<AbstractButton> e = Main.map.toolGroup.getElements() ; e.hasMoreElements() ;) {
            AbstractButton x=e.nextElement();
            x.setEnabled(((MapMode)x.getAction()).layerIsSupported(layer));
        }

From DrawAction.java

    @Override
    protected void updateEnabledState() {
        setEnabled(getEditLayer() != null);
    }

getEditLayer returns one of the datalayers even if it's not active.

I agree that it's somewhat confusing though. I'd vote for a change.

comment:2 Changed 8 years ago by Larry0ua

The problem may be even deeper... I cannot reach that code, may some layerChangeListener forgot to remove mouseMotionListener from data layers? That is as addition for that you mentioned.

comment:3 Changed 8 years ago by skyper

#6518 and #6447 are about similar problems

Changed 8 years ago by Larry0ua

Attachment: patch.diff added

patch for josm\core\src\org\openstreetmap\josm\gui\MapFrame.java

comment:4 Changed 8 years ago by Larry0ua

Attached patch file for this functionality - take a look, that is quite simple. The cause of the bug was that MapMode was not switched when new layer added without default MapMode.

Looks like that it fixes #6518 and #6447 also.

comment:5 Changed 8 years ago by skyper

Summary: Data Layer can be changed after selecting another layer[Patch] Data Layer can be changed after selecting another layer

Thanks for your work.

Next time, please change the summary to get your work better noticed.

comment:6 Changed 8 years ago by olejorgenb

This doesn't fix the issue completely though. If you switch between the modes using shortcuts when the gpx layer is active, you can manipulate the non-active layer again.

Given that most users won't change modes deliberately when in a gpx/imagery/etc. layer, the patch will probably avoid 80+% of confusing cases though.

But as said, I get the impression it's intentional that the modes should work when the edit layer(s) is passive. Is that correct?

PS: Testing the patch, I can't see that it fixes #6447?

(EDIT:grammar/spelling)

Last edited 8 years ago by olejorgenb (previous) (diff)

comment:7 Changed 8 years ago by Larry0ua

I see #6447 - it is not fixed, and it looks like quite another bug.
I'm attaching next generation fix for current bug.

Changed 8 years ago by Larry0ua

Attachment: patch2.diff added

josm\core\src\org\openstreetmap\josm patch

comment:8 Changed 8 years ago by Larry0ua

Summary: [Patch] Data Layer can be changed after selecting another layer[Patch-2] Data Layer can be changed after selecting another layer

comment:9 Changed 8 years ago by stoecker

Resolution: fixed
Status: newclosed

In [4567/josm]:

fix #6875 - patch by Larry0ua - Data Layer can be changed after selecting another layer

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.