Skip to content

Commit 87642aa

Browse files
committed
Don't deselect the current task if the user clicks somewhere in the map view
Signed-off-by: Taylor Smock <tsmock@meta.com>
1 parent fbd72d1 commit 87642aa

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/main/java/org/openstreetmap/josm/plugins/maproulette/gui/layer/MapRouletteClusteredPointLayer.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import org.openstreetmap.josm.data.osm.Relation;
3636
import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
3737
import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer;
38+
import org.openstreetmap.josm.data.preferences.CachingProperty;
39+
import org.openstreetmap.josm.data.preferences.IntegerProperty;
3840
import org.openstreetmap.josm.data.preferences.NamedColorProperty;
3941
import org.openstreetmap.josm.gui.MainApplication;
4042
import org.openstreetmap.josm.gui.MapView;
@@ -62,6 +64,10 @@
6264
* A layer for showing task locations
6365
*/
6466
public class MapRouletteClusteredPointLayer extends Layer implements MouseListener {
67+
/** The number of clicks for deselection */
68+
private static final CachingProperty<Integer> DESELECT_CLICK_COUNT = new IntegerProperty(
69+
"maproulette.task.deselect.mouse.click.count", 3).cached();
70+
6571
/**
6672
* The style source, mostly used for preferences
6773
*/
@@ -292,7 +298,11 @@ public void mouseClicked(MouseEvent e) {
292298
}
293299
}
294300
}
295-
this.setSelected(add);
301+
if (add.isEmpty() && e.getClickCount() >= DESELECT_CLICK_COUNT.get()) {
302+
this.setSelected(Collections.emptyList());
303+
} else if (!add.isEmpty()) {
304+
this.setSelected(add);
305+
}
296306
this.invalidate();
297307
}
298308

0 commit comments

Comments
 (0)