Skip to content

Commit c48a274

Browse files
author
interactive-game-maps
committed
Add coordinates transformation example
1 parent d5e6f25 commit c48a274

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

map.js

+2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
// Step 1:
1010
// Initialize the map with basic information
1111
var interactive_map = new InteractiveMap('map', {
12+
// This will limit automatic zooming to this zoom level
1213
max_good_zoom: 6,
14+
// This is the max zoom the map will allow
1315
max_map_zoom: 8,
1416
website_source: 'https://github.com/interactive-game-maps/template',
1517
website_subdir: 'template',

marker_logic/information.js

+8
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ function addInformation(map) {
8282
fillColor: 'red',
8383
fillOpacity: 0.2
8484
};
85+
},
86+
87+
// If the coordinates are extracted from the game files they might need a transformation to
88+
// map correctly
89+
coordsToLatLng: function (coords) {
90+
var lx = (coords[0] + 1) * 0.5;
91+
var ly = (coords[1] - 1) * 0.5;
92+
return L.latLng(ly, lx);
8593
}
8694

8795
// Some additional notes:

0 commit comments

Comments
 (0)