mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Cancel a view-bounded load when the camera returns to the drawn view
Moving from view A to B started B's request; moving back to A before it finished returned early because A was already drawn, so B's request ran on and its features replaced A's while the camera was at A. Returning to the drawn view now cancels the request in between.
This commit is contained in:
1 parent
0f13c0a1c2
commit
7d91a1875b
2 files changed
+51
-1
No files matched your search
+10
-1
@@ -753,7 +753,16 @@ export function createLibraryViewLayer(
|
||||
const box = viewBox(height);
|
||||
if (!box) return;
|
||||
const key = box.map((value) => value.toFixed(4)).join(',');
|
||||
if (key === loadedKey && dataSource) return;
|
||||
// Back on the view already drawn: a request for the view in between is
|
||||
// obsolete and must not replace it.
|
||||
if (key === loadedKey && dataSource) {
|
||||
if (controller) {
|
||||
abort();
|
||||
loading = false;
|
||||
render();
|
||||
}
|
||||
return;
|
||||
}
|
||||
abort();
|
||||
const current = new AbortController();
|
||||
controller = current;
|
||||
|
||||
Reference in new issue
Block a user