-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve default map bounds selection. Close #23
- Loading branch information
Showing
4 changed files
with
82 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,9 @@ | |
<script src="{{ asset('bundles/sonataformatter/markitup/sets/markdown/set.js') }}" type="text/javascript"></script> | ||
<script src="{{ asset('bundles/sonataformatter/markitup/sets/html/set.js') }}" type="text/javascript"></script> | ||
<script src="{{ asset('bundles/sonataformatter/markitup/sets/textile/set.js') }}" type="text/javascript"></script> | ||
|
||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" /> | ||
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script> | ||
<script src="{{ asset('js/external-pages.js') }}"></script> | ||
<script> | ||
// bootstrap-ckeditor-modal-fix.js | ||
// hack to fix ckeditor/bootstrap compatiability bug when ckeditor appears in a bootstrap modal dialog | ||
|
@@ -78,6 +80,8 @@ | |
window.SONATA_CONFIG.CONFIRM_EXIT = false; | ||
</script> | ||
|
||
|
||
|
||
{% endblock %} | ||
|
||
{% block sonata_sidebar_search %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...DirectoryBundle/Resources/views/admin/core_custom/custom-fields/viewport-picker.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<label>Vue par défault de la carte (dessinez un rectangle sur la carte)</label> | ||
<div id="map-bounds-select"></div> | ||
|
||
<script> | ||
jQuery(document).ready(function() { | ||
map = L.map('map-bounds-select', {editable: true}); | ||
L.tileLayer("{{ form.vars.attr['data-title-layer'] }}").addTo(map); | ||
map.fitBounds({{ form.vars.attr['data-default-bounds'] | raw }}); | ||
// Start drawing rectangle | ||
map.editTools.startRectangle(); | ||
shades = new L.LeafletShades(); | ||
shades.addTo(map); | ||
shades.on('shades:bounds-changed', function(event) { | ||
bounds = event.bounds; | ||
console.log("bounds changed"); | ||
var digits = 5; | ||
$('.bounds.SWLat').val(L.Util.formatNum(bounds.getSouthWest().lat, digits)); | ||
$('.bounds.SWLng').val(L.Util.formatNum(bounds.getSouthWest().lng, digits)); | ||
$('.bounds.NELat').val(L.Util.formatNum(bounds.getNorthEast().lat, digits)); | ||
$('.bounds.NELng').val(L.Util.formatNum(bounds.getNorthEast().lng, digits)); | ||
}); | ||
}); | ||
</script> | ||
<style> | ||
.leaflet-areaselect-shade { | ||
position: absolute; | ||
background: rgba(0,0,0,0.4); | ||
z-index: 400; | ||
} | ||
.leaflet-interactive.leaflet-path-draggable { | ||
fill: transparent !important; | ||
} | ||
#map-bounds-select { | ||
height: 400px; | ||
margin-top: 1.5rem; | ||
border-radius: 2px; | ||
z-index: 500; | ||
} | ||
a.leaflet-control-zoom-in { | ||
font-size: 18px !important; | ||
color: #3d3d3d; | ||
} | ||
a.leaflet-control-zoom-out { | ||
font-size: 25px! important; | ||
font-weight: normal; | ||
color: #3d3d3d; | ||
text-indent: 0; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters