You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
803 B

7 years ago
7 years ago
7 years ago
  1. var FullscreenControl = L.Control.extend({
  2. options: {
  3. position: 'topleft'
  4. // control position - allowed: 'topleft', 'topright', 'bottomleft', 'bottomright'
  5. },
  6. onAdd: function (map) {
  7. var container = L.DomUtil.create('div', 'leaflet-bar leaflet-control-fullscreen')
  8. container.innerHTML = "<a href='#'><i class='fa fa-arrows-alt'></i></a>"
  9. container.title = lang('toggle_fullscreen')
  10. container.onclick = function () {
  11. document.body.classList.toggle('fullscreen')
  12. map.invalidateSize()
  13. return false
  14. }
  15. return container
  16. }
  17. })
  18. register_hook('init', function (callback) {
  19. map.addControl(new FullscreenControl())
  20. })
  21. register_hook('show', function (url, options) {
  22. if (options.showDetails) {
  23. document.body.classList.remove('fullscreen')
  24. }
  25. })