Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

Commit

Permalink
[fix] set correct reverse coordinate convertion
Browse files Browse the repository at this point in the history
  • Loading branch information
cedoor committed Aug 26, 2018
1 parent 0ea267d commit a20ebd9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/map/handlers/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,13 @@ export default class Nodes {
fixedCoordinates: Coordinates = {} as Coordinates;

if (coordinates.x) {
fixedCoordinates.x = (coordinates.x - zoomCoordinates.x * (reverse ? -1 : 1)) / zoomCoordinates.k;
fixedCoordinates.x = (coordinates.x - zoomCoordinates.x * (reverse ? -1 : 1))
* (reverse ? zoomCoordinates.k : 1/zoomCoordinates.k);
}

if (coordinates.y) {
fixedCoordinates.y = (coordinates.y - zoomCoordinates.y * (reverse ? -1 : 1)) / zoomCoordinates.k;
fixedCoordinates.y = (coordinates.y - zoomCoordinates.y * (reverse ? -1 : 1))
* (reverse ? zoomCoordinates.k : 1/zoomCoordinates.k);
}

return fixedCoordinates;
Expand Down

0 comments on commit a20ebd9

Please sign in to comment.