Fix Y value Calculation.
This commit is contained in:
1 file changed
+5
-5
@@ -503,15 +503,15 @@ function redrawDynamics(){
|
||||
// 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.
|
||||
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;
|
||||
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.y = newY;
|
||||
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;
|
||||
|
||||
Reference in new issue
Block a user