nycMap = {
let container = DOM.element('div', {id: `nyc_sd_map_div`, style: `width:${width}px;height:${width/1.8}px` });
yield container;
let map = L.map(container, {fullscreenControl: true,
fullscreenControlOptions: {forcePseudoFullscreen: false},
});
let esriImage = L.tileLayer.provider('Esri.WorldImagery');
let cartoMap = L.tileLayer.provider('CartoDB.Positron').addTo(map);
let nycSchoolLayer = L.geoJson(nyc_schooldistricts, {
weight: 2,
color: "blue",
fillColor: "brown",
fillOpacity: 0.3
}).bindTooltip((l) => {
return "School District " + l.feature.properties.school_dist;
}).addTo(map);
map.fitBounds(nycSchoolLayer.getBounds().pad(-0.80));
L.control.layers({"ESRI Imagery": esriImage,
"Carto Location": cartoMap},
{"NYC School Districts": nycSchoolLayer}
).addTo(map);
let container_resize = () => {
let width = container.parentElement.offsetWidth;
let height = (document.fullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement ||
document.msFullscreenElement)
? container.parentElement.offsetHeight
: (width / 1.6);
container.style.width = null || width + 'px';
container.style.height = null || height + 'px';
};
window.onresize = () => { container_resize(); };
container_resize();
map.on('enterFullscreen', function () {
map.getContainer().parentElement.requestFullscreen();
let widthL = container.parentElement.offsetWidth;
let heightL = (document.fullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement ||
document.msFullscreenElement)
? container.parentElement.offsetHeight
: (widthL / 1.8);
console.log("W:" + widthL + "; H: " + heightL);
container.style.width = widthL + 'px';
container.style.height = heightL + 'px';
});
map.on('exitFullscreen', function () {
});
mutable mapVariables = [map, nycSchoolLayer];
}