44 lines
876 B
JavaScript
44 lines
876 B
JavaScript
console.log("hello from map.js")
|
|
|
|
var maxZoomLevel = 6
|
|
var tileSize = 256
|
|
|
|
var maxLenght = Math.pow(2, maxZoomLevel) * tileSize
|
|
|
|
var mapNE = [maxLenght, 0]
|
|
var mapSW = [0, maxLenght]
|
|
|
|
var map = L.map('map', {'attributionControl': false}).setView([0,0],1);
|
|
|
|
L.tileLayer('asset/tiles/{z}/{x}/{y}.png', {
|
|
minZoom: 1,
|
|
maxZoom: maxZoomLevel,
|
|
continuousWorld: false,
|
|
noWrap: true,
|
|
crs: L.CRS.Simple,
|
|
}).addTo(map);
|
|
|
|
map.setMaxBounds(new L.LatLngBounds(
|
|
map.unproject(mapSW, map.getMaxZoom()),
|
|
map.unproject(mapNE, map.getMaxZoom())
|
|
))
|
|
|
|
console.log("getMaxZoom:")
|
|
console.log(map.getMaxZoom())
|
|
|
|
|
|
var markPointerIcon = L.icon({
|
|
iconUrl: 'asset/markers/pointer.png',
|
|
iconSize: [22, 32],
|
|
iconAnchor: [7, 20],
|
|
popupAnchor: [-10, -34],
|
|
});
|
|
|
|
|
|
var marker = L.marker([0,0], {icon: markPointerIcon}).addTo(map);
|
|
|
|
/*
|
|
min/max = 163
|
|
map.setView([-163,-163],2)
|
|
*/
|