Skip to content

Commit

Permalink
Don't deselect the current task if the user clicks somewhere in the m…
Browse files Browse the repository at this point in the history
…ap view

Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Feb 28, 2023
1 parent fbd72d1 commit 87642aa
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import org.openstreetmap.josm.data.osm.Relation;
import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer;
import org.openstreetmap.josm.data.preferences.CachingProperty;
import org.openstreetmap.josm.data.preferences.IntegerProperty;
import org.openstreetmap.josm.data.preferences.NamedColorProperty;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.MapView;
Expand Down Expand Up @@ -62,6 +64,10 @@
* A layer for showing task locations
*/
public class MapRouletteClusteredPointLayer extends Layer implements MouseListener {
/** The number of clicks for deselection */
private static final CachingProperty<Integer> DESELECT_CLICK_COUNT = new IntegerProperty(
"maproulette.task.deselect.mouse.click.count", 3).cached();

/**
* The style source, mostly used for preferences
*/
Expand Down Expand Up @@ -292,7 +298,11 @@ public void mouseClicked(MouseEvent e) {
}
}
}
this.setSelected(add);
if (add.isEmpty() && e.getClickCount() >= DESELECT_CLICK_COUNT.get()) {
this.setSelected(Collections.emptyList());
} else if (!add.isEmpty()) {
this.setSelected(add);
}
this.invalidate();
}

Expand Down

0 comments on commit 87642aa

Please sign in to comment.