function reCenterMap(center) { 'use strict'; map.setView(center, map.getZoom()); setTimeout(function () { map.invalidateSize(true); }, 100); // location.reload() } function SwapOrientation() { 'use strict'; var center = map.getCenter(); // location.reload() map.setView(center, map.getZoom()); var swapfile = document.getElementById("printpreview-swapFile"); if ($('#pp-ltr-land').prop('disabled')) { $('#pp-ltr-port').attr('disabled', 'disabled'); $('#pp-ltr-land').removeAttr('disabled'); $("#map").css("height", "175mm !important ") swapfile.children[0].className = swapfile.children[0].className.replace(/\ fa-rotate-90/g, ""); swapfile.innerHTML = swapfile.innerHTML.replace(/چشم انداز/g, "پرتره"); } else { $('#pp-ltr-port').removeAttr('disabled'); $('#pp-ltr-land').attr('disabled', 'disabled'); $("#map").css("height", "93vh !important ") swapfile.children[0].className += " fa-rotate-90"; swapfile.innerHTML = swapfile.innerHTML.replace(/پرتره/g, "چشم انداز"); } reCenterMap(center); } function cancelPrintPreview() { 'use strict'; // var center = map.getCenter(); // // get query params // $('#pp-main').attr('disabled', 'disabled'); // $('#pp-ltr-land').attr('disabled', 'disabled'); // $('#pp-ltr-port').attr('disabled', 'disabled'); // $('#map').unwrap().unwrap(); // $('.leaflet-control-printpreview-bar').remove(); // $('#map').removeClass('previewmap'); // reCenterMap(center); location.reload() } L.Control.PrintPreview = L.Control.extend({ options: { title: 'Print preview', position: 'topleft' }, onAdd: function () { 'use strict'; //create button and setup click listner var container = L.DomUtil.create('div', 'leaflet-bar leaflet-control'); this.link = L.DomUtil.create('a', 'leaflet-control-PrintPreview-button leaflet-bar-part', container); L.DomUtil.create('i', 'fa fa-print fa-lg', this.link); this.link.title = this.options.title; L.DomEvent.addListener(this.link, 'click', this.PrintPreview, this.options); return container; }, PrintPreview: function () { 'use strict'; var center = map.getCenter(); map.setView(center, map.getZoom()); console.log("start") $(".guid-custom-box").css("display", "none") $(".guid-custom-box-item").css("display", "none") $(".guid-custom-box-fast").css("display", "none") $(".guid-custom-boxcamp").css("display", "none") $(".guid-custom-box-allpoint").css("display", "none") $(".guid-custom-box-251points").css("display", "none") $(".guid-custom-box-rahdar").css("display", "none") $(".navbar").css("display", "none") $(".leaflet-control-PrintPreview-button").css("display", "none") $(".showWhereThere").css("display", "none") //add print preview elements $('#map').addClass('previewmap'); $('#map').wrap('