Allow Mapillary signs layer only if image layer is already enabled

This commit is contained in:
Bryan Housel
2016-05-27 23:37:40 -04:00
parent 0eac0ff862
commit 368b861818
3 changed files with 28 additions and 4 deletions
+1 -1
View File
@@ -425,7 +425,7 @@ en:
tooltip: "Street-level photos from Mapillary"
title: "Photo Overlay (Mapillary)"
mapillary_signs:
tooltip: "Traffic signs from Mapillary"
tooltip: "Traffic signs from Mapillary (must enable Photo Overlay)"
title: "Traffic Sign Overlay (Mapillary)"
mapillary:
view_on_mapillary: "View this image on Mapillary"
+1 -1
View File
@@ -512,7 +512,7 @@
"title": "Photo Overlay (Mapillary)"
},
"mapillary_signs": {
"tooltip": "Traffic signs from Mapillary",
"tooltip": "Traffic signs from Mapillary (must enable Photo Overlay)",
"title": "Traffic Sign Overlay (Mapillary)"
},
"mapillary": {
+26 -2
View File
@@ -39,20 +39,35 @@ iD.ui.MapData = function(context) {
update();
}
function toggleLayer(which) {
function showsLayer(which) {
var layer = layers.layer(which);
if (layer) {
layer.enabled(!layer.enabled());
return layer.enabled();
}
return false;
}
function setLayer(which, enabled) {
var layer = layers.layer(which);
if (layer) {
layer.enabled(enabled);
update();
}
}
function toggleLayer(which) {
setLayer(which, !showsLayer(which));
}
function clickGpx() {
toggleLayer('gpx');
}
function clickMapillaryImages() {
toggleLayer('mapillary-images');
if (!showsLayer('mapillary-images')) {
setLayer('mapillary-signs', false);
}
}
function clickMapillarySigns() {
@@ -128,8 +143,13 @@ iD.ui.MapData = function(context) {
mapillarySignLayerItem
.classed('active', showsMapillarySigns)
.selectAll('input')
.property('disabled', !showsMapillaryImages)
.property('checked', showsMapillarySigns);
mapillarySignLayerItem
.selectAll('label')
.classed('deemphasize', !showsMapillaryImages);
// Exit
mapillaryImageLayerItem.exit()
.remove();
@@ -200,6 +220,10 @@ iD.ui.MapData = function(context) {
.property('disabled', !hasGpx)
.property('checked', showsGpx);
gpxLayerItem
.selectAll('label')
.classed('deemphasize', !hasGpx);
// Exit
gpxLayerItem.exit()
.remove();