Fix Y value Calculation.

This commit is contained in:
David Camp committed 2025-08-11 22:13:01 -07:00
1 parent 2d69836887
commit 70943cf60d
1 file changed
+5 -5
+5 -5
View File
@@ -503,15 +503,15 @@ function redrawDynamics(){
// Placing this here means the map should always snap to the player if the toggle is on. // Placing this here means the map should always snap to the player if the toggle is on.
// Placing it after culling means that if the user fast travels the map won't snap to them until manually scrolled to near their position. // Placing it after culling means that if the user fast travels the map won't snap to them until manually scrolled to near their position.
if(MapData.layers.gps && marker.type === 'player') { if(MapData.layers.gps && marker.type === 'player') {
//This works fine
// These functions are very closely related to convertX and convertY
let newX = -marker.position.x * MapData.view.scale + mapCanvas.width * 0.5; let newX = -marker.position.x * MapData.view.scale + mapCanvas.width * 0.5;
if(Math.abs(MapData.view.x - newX) >= 10) { // Needs some tuning, but the idea is to not keep calling the map update _constantly_ when stationary. let newY = ((MapData.matrix.minY+MapData.matrix.maxY-marker.position.z) * MapData.view.scale - mapCanvas.height * 0.5);
if(Math.abs(MapData.view.x - newX) >= 10 || Math.abs(MapData.view.y - newY) >= 10) {
MapData.view.x = newX; MapData.view.x = newX;
MapData.view.y = newY;
MapData.view.dirty = true; MapData.view.dirty = true;
} }
//This calculation does not
// MapData.view.y = -marker.position.z * MapData.view.scale;
} }
if(marker.hidden || (marker.minZoom && MapData.view.scale < marker.minZoom) || (marker.maxZoom && MapData.view.scale > marker.maxZoom)) continue; if(marker.hidden || (marker.minZoom && MapData.view.scale < marker.minZoom) || (marker.maxZoom && MapData.view.scale > marker.maxZoom)) continue;