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

Commit

Permalink
HARP-11145 Fix adding rotating callback to completion of first frame (#…
Browse files Browse the repository at this point in the history
…1670)

Signed-off-by: Jonathan Stichbury <2533428+nzjony@users.noreply.github.com>
  • Loading branch information
nzjony committed Jul 8, 2020
1 parent a6924ce commit 607c580
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions www/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ function main() {
const options = { target: Boston, zoomLevel, tilt: 34.3, heading: 135 };
map.lookAt(options);

map.addEventListener(MapViewEventNames.FrameComplete, () => {
const onFrameComplete = () => {
// FrameComplete is fired multiple times (each time the camera changes and the tiles are
// loaded), hence we just set the Render event listener once below.
map.removeEventListener(MapViewEventNames.FrameComplete, onFrameComplete);
canvas.style.opacity = "1";

map.addEventListener(MapViewEventNames.Render, () =>
Expand All @@ -117,7 +120,8 @@ function main() {
setTimeout(() => {
map.beginAnimation();
}, 0.5);
});
};
map.addEventListener(MapViewEventNames.FrameComplete, onFrameComplete);
}

main();

0 comments on commit 607c580

Please sign in to comment.