Skip to content

Commit 7839271

Browse files
committed
fix: correct map coordinate handling for negative Z-axis
1 parent e82b21c commit 7839271

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/main/resources/web/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ <h3>Players</h3>
203203
});
204204

205205
tileLayer.addTo(map);
206-
map.setView([spawnZ, spawnX], 2);
206+
map.setView([-spawnZ, spawnX], 2);
207207

208208
// Update player markers for new world
209209
updatePlayerMarkersVisibility();
@@ -245,7 +245,7 @@ <h3>Players</h3>
245245
if (playerMarkers.has(player.uuid)) {
246246
// Update existing marker position
247247
const markerData = playerMarkers.get(player.uuid);
248-
markerData.marker.setLatLng([player.z, player.x]);
248+
markerData.marker.setLatLng([-player.z, player.x]);
249249
markerData.marker.setPopupContent(
250250
`<b>${player.name}</b><br>X: ${player.x}, Y: ${player.y}, Z: ${player.z}`
251251
);
@@ -260,7 +260,7 @@ <h3>Players</h3>
260260
}
261261
} else {
262262
// Create new marker
263-
const marker = L.marker([player.z, player.x], {
263+
const marker = L.marker([-player.z, player.x], {
264264
icon: L.divIcon({
265265
className: 'player-marker',
266266
iconSize: [12, 12],
@@ -298,7 +298,7 @@ <h3>Players</h3>
298298
`;
299299
item.onclick = () => {
300300
if (player.world === currentWorld) {
301-
map.setView([player.z, player.x], MAX_TILE_ZOOM);
301+
map.setView([-player.z, player.x], MAX_TILE_ZOOM);
302302
} else {
303303
document.getElementById('world-select').value = player.world;
304304
selectWorld(player.world, player.x, player.z);
@@ -322,7 +322,7 @@ <h3>Players</h3>
322322
lastCoordUpdate = now;
323323

324324
const x = Math.floor(e.latlng.lng);
325-
const z = Math.floor(e.latlng.lat);
325+
const z = -Math.floor(e.latlng.lat);
326326
document.getElementById('coords').textContent = `X: ${x}, Z: ${z}`;
327327
});
328328

0 commit comments

Comments
 (0)