Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
jack77213 | bb1a6ff2cd | |
jack77213 | 056d65c67f |
|
@ -1,8 +1,10 @@
|
|||
import L from 'leaflet';
|
||||
import 'leaflet/dist/leaflet.css';
|
||||
import * as marker from './marker.js';
|
||||
import mapsize from './mapsize.js';
|
||||
|
||||
let bounds = [[0,0], [-3840, 3840]];
|
||||
let mapName = window.location.hash.slice(1)
|
||||
let bounds = [[0,0], [-mapsize[mapName]/4, mapsize[mapName]/4]];
|
||||
|
||||
let map = L.map('map', {
|
||||
crs: L.CRS.Simple,
|
||||
|
@ -10,13 +12,13 @@ let map = L.map('map', {
|
|||
maxZoom: 4
|
||||
});
|
||||
|
||||
L.tileLayer('./maps/build/{z}/x{x}_y{y}.jpg', {
|
||||
L.tileLayer('./maps/'+mapName+'/{z}/x{x}_y{y}.jpg', {
|
||||
minZoom: -1,
|
||||
maxZoom: 4,
|
||||
minNativeZoom: 1,
|
||||
maxNativeZoom: 3,
|
||||
tileSize: 1000,
|
||||
bounds: [[0,0], [-3840, 3840]]
|
||||
bounds: bounds
|
||||
}).addTo(map);
|
||||
|
||||
// let image = L.imageOverlay('./maps/Tanoa.png', bounds).addTo(map);
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
export default {
|
||||
"Tanoa": 15360,
|
||||
"Enoch": 12800
|
||||
}
|
|
@ -1,4 +1,7 @@
|
|||
import L from 'leaflet';
|
||||
import mapsize from './mapsize.js';
|
||||
|
||||
let mapName = window.location.hash.slice(1);
|
||||
|
||||
const icon_types = {
|
||||
"blue": "blue.png",
|
||||
|
@ -18,7 +21,7 @@ function makeMarker(coord=[0, 0], icon='loc_blue', text='') {
|
|||
});
|
||||
|
||||
let [x, y] = coord;
|
||||
y = y/8 - (15360/8);
|
||||
y = y/8 - (mapsize[mapName]/8);
|
||||
x = x/8;
|
||||
let marker = L.marker(L.latLng(y, x), {icon: markerIcon});
|
||||
// https://gis.stackexchange.com/questions/59571/how-to-add-text-only-labels-on-leaflet-map-with-no-icon
|
||||
|
@ -34,7 +37,7 @@ function makeUnitPos(coord=[0, 0], icon='purple') {
|
|||
});
|
||||
|
||||
let [x, y] = coord;
|
||||
y = y/8 - (15360/8);
|
||||
y = y/8 - (mapsize[mapName]/8);
|
||||
x = x/8;
|
||||
let marker = L.marker(L.latLng(y, x), {icon: markerIcon});
|
||||
return marker;
|
||||
|
|
Loading…
Reference in New Issue