0

Make icons in legend OptIn

Make them OptIn
Add option to docs
This commit is contained in:
Jens
2020-07-01 19:45:44 +02:00
parent 8c0028495d
commit d7f6f3ebd5
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``
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``
Optional. Specifies whether or not this marker group will be checked(visible) by default when
the map loads. Defaults to False

View File

@@ -568,7 +568,8 @@ def main():
displayName=f['name'],
icon=f.get('icon', 'signpost_icon.png'),
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)
# initialize the structure for the markers

View File

@@ -424,8 +424,14 @@ overviewer.util = {
marker_group.addLayer(layerObj);
}
// Save marker group
var layer_name_html = marker_entry.displayName +
var layer_name_html;
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;
}
}