Skip to content

Commit

Permalink
fix: airplane symbol with offsets (#8700)
Browse files Browse the repository at this point in the history
fix: plane not visible if bounding box is offset from chart
  • Loading branch information
Saschl committed Jun 25, 2024
1 parent 6e644c7 commit 2bfb9a3
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ export const ChartViewer = () => {
const dy = boundingBox.planview.pixels.y1 - boundingBox.planview.pixels.y2;
const dLat = boundingBox.planview.latlng.lat2 - boundingBox.planview.latlng.lat1;
const dLon = boundingBox.planview.latlng.lng2 - boundingBox.planview.latlng.lng1;
const x = boundingBox.planview.pixels.x1 + dx * ((aircraftLongitude - boundingBox.planview.latlng.lng1) / dLon);
const y = boundingBox.planview.pixels.y2 + dy * ((boundingBox.planview.latlng.lat2 - aircraftLatitude) / dLat);
const x = dx * ((aircraftLongitude - boundingBox.planview.latlng.lng1) / dLon);
const y = dy * ((boundingBox.planview.latlng.lat2 - aircraftLatitude) / dLat);

setAircraftIconPosition({ x, y, r: aircraftTrueHeading });
visible = true;
Expand Down Expand Up @@ -530,7 +530,8 @@ export const ChartViewer = () => {
width={boundingBox.planview.pixels.x2 - boundingBox.planview.pixels.x1}
height={Math.abs(boundingBox.planview.pixels.y1 - boundingBox.planview.pixels.y2)}
viewBox={`0 0 ${boundingBox.planview.pixels.x2 - boundingBox.planview.pixels.x1} ${Math.abs(boundingBox.planview.pixels.y1 - boundingBox.planview.pixels.y2)}`}
className="absolute left-0 top-0 z-30"
style={{ left: boundingBox.planview.pixels.x1, top: boundingBox.planview.pixels.y2 }}
className="absolute z-30"
>
<g
className="transition duration-100"
Expand Down

0 comments on commit 2bfb9a3

Please sign in to comment.