Add "Center map on marker" option
This commit is contained in:
parent
bf7b2cf381
commit
3eb4f1938c
2 changed files with 21 additions and 1 deletions
|
@ -61,7 +61,19 @@ L.OSM.share = function (options) {
|
||||||
.bind('change', toggleMarker))
|
.bind('change', toggleMarker))
|
||||||
.append(I18n.t('javascripts.share.include_marker')));
|
.append(I18n.t('javascripts.share.include_marker')));
|
||||||
|
|
||||||
var $shortLink, $longLink;
|
$('<div>')
|
||||||
|
.attr('class', 'form-row')
|
||||||
|
.appendTo($form)
|
||||||
|
.append(
|
||||||
|
$('<label>')
|
||||||
|
.attr('for', 'center_marker')
|
||||||
|
.append(
|
||||||
|
$('<input>')
|
||||||
|
.attr('id', 'center_marker')
|
||||||
|
.attr('type', 'checkbox')
|
||||||
|
.prop('checked', true)
|
||||||
|
.bind('change', update))
|
||||||
|
.append(I18n.t('javascripts.share.center_marker')));
|
||||||
|
|
||||||
$('<div>')
|
$('<div>')
|
||||||
.attr('class', 'form-row')
|
.attr('class', 'form-row')
|
||||||
|
@ -245,11 +257,18 @@ L.OSM.share = function (options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
|
if (map.hasLayer(marker) && $('#center_marker').is(':checked')) {
|
||||||
|
map.panTo(marker.getLatLng());
|
||||||
|
}
|
||||||
|
|
||||||
var bounds = map.getBounds();
|
var bounds = map.getBounds();
|
||||||
|
|
||||||
$('#link_marker')
|
$('#link_marker')
|
||||||
.prop('checked', map.hasLayer(marker));
|
.prop('checked', map.hasLayer(marker));
|
||||||
|
|
||||||
|
$('#center_marker')
|
||||||
|
.prop('disabled', !map.hasLayer(marker));
|
||||||
|
|
||||||
$('#image_filter')
|
$('#image_filter')
|
||||||
.prop('checked', locationFilter.isEnabled());
|
.prop('checked', locationFilter.isEnabled());
|
||||||
|
|
||||||
|
|
|
@ -2063,6 +2063,7 @@ en:
|
||||||
download: "Download"
|
download: "Download"
|
||||||
short_url: "Short URL"
|
short_url: "Short URL"
|
||||||
include_marker: "Include marker"
|
include_marker: "Include marker"
|
||||||
|
center_marker: "Center map on marker"
|
||||||
paste_html: "Paste HTML to embed in website"
|
paste_html: "Paste HTML to embed in website"
|
||||||
key:
|
key:
|
||||||
title: "Map Key"
|
title: "Map Key"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue