Skip to content

Commit

Permalink
add comments to the code to make it easier to find the necessary elem…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
sergeiown committed May 27, 2024
1 parent 74eda6c commit 71f0b3c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export function initializeMap() {

const map = L.map('map').setView([49.1, 31.2], initialZoom);

// Create a button to set the default coordinates and zoom
const centerButton = createControlButton({
position: 'topleft',
title: 'Set the default position',
Expand All @@ -26,6 +27,7 @@ export function initializeMap() {
});
map.addControl(new centerButton());

// Creation of full screen button for desktop device
if (!isMobile) {
const fullScreenButton = createControlButton({
position: 'topleft',
Expand All @@ -40,6 +42,7 @@ export function initializeMap() {
map.addControl(new fullScreenButton());
}

// Create a button to call the external map frame
const frontButton = createControlButton({
position: 'bottomleft',
title: 'Front line map',
Expand All @@ -66,6 +69,7 @@ export function initializeMap() {
});
map.addControl(new frontButton());

// Create a button to call the legend right after creating a dropdown list
map.on('dropdownCreated', function () {
const legendButton = createControlButton({
position: 'topright',
Expand All @@ -78,9 +82,11 @@ export function initializeMap() {
map.addControl(new legendButton());
});

// Create a button for selecting map layers
const layerControl = L.control.layers(layers.baseLayers, null, { position: 'topleft' });
layerControl.addTo(map);

// Create a scale control tool
const scaleControl = L.control
.scale({
Width: 50,
Expand All @@ -93,6 +99,7 @@ export function initializeMap() {

scaleControl.getContainer().setAttribute('title', 'Map scale');

// Create zoom control buttons
map.zoomControl.setPosition('bottomright');

updateLayer(map);
Expand Down

0 comments on commit 71f0b3c

Please sign in to comment.