0

Merge PR #1796 from DragonDev1906

Make icons in legend OptIn
This commit is contained in:
Nicolas F
2020-07-11 14:19:00 +02:00
committed by GitHub
3 changed files with 13 additions and 3 deletions

View File

@@ -215,6 +215,9 @@ The following keys are accepted in the marker dictionary:
``createInfoWindow`` ``createInfoWindow``
Optional. Specifies whether or not the icon displays an info window on click. Defaults to True Optional. Specifies whether or not the icon displays an info window on click. Defaults to True
``showIconInLegend``
Optional. Specifies whether or not the icon is displayed in the legend. Defaults to False
``checked`` ``checked``
Optional. Specifies whether or not this marker group will be checked(visible) by default when Optional. Specifies whether or not this marker group will be checked(visible) by default when
the map loads. Defaults to False the map loads. Defaults to False

View File

@@ -568,7 +568,8 @@ def main():
displayName=f['name'], displayName=f['name'],
icon=f.get('icon', 'signpost_icon.png'), icon=f.get('icon', 'signpost_icon.png'),
createInfoWindow=f.get('createInfoWindow', True), createInfoWindow=f.get('createInfoWindow', True),
checked=f.get('checked', False)) checked=f.get('checked', False),
showIconInLegend=f.get('showIconInLegend', False))
marker_groups[rname].append(group) marker_groups[rname].append(group)
# initialize the structure for the markers # initialize the structure for the markers

View File

@@ -424,8 +424,14 @@ overviewer.util = {
marker_group.addLayer(layerObj); marker_group.addLayer(layerObj);
} }
// Save marker group // Save marker group
var layer_name_html = marker_entry.displayName + var layer_name_html;
'<img class="ov-marker-legend" src="' + marker_entry.icon + '"></img>'; if (marker_entry.showIconInLegend) {
layer_name_html = marker_entry.displayName +
'<img class="ov-marker-legend" src="' + marker_entry.icon + '"></img>';
}
else {
layer_name_html = marker_entry.displayName;
}
obj.marker_groups[layer_name_html] = marker_group; obj.marker_groups[layer_name_html] = marker_group;
} }
} }