fix receivechunk extension hook

This commit is contained in:
HF 2022-11-11 01:18:40 +01:00
parent 9e11ea3729
commit 0a4ad3a906
3 changed files with 5 additions and 13 deletions

View File

@ -229,10 +229,12 @@ export function preLoadedBigChunk(
export function receiveBigChunk(
center,
chunk,
) {
return {
type: 'REC_BIG_CHUNK',
center,
chunk,
};
}

View File

@ -265,7 +265,7 @@ class ChunkLoader {
try {
const img = await loadImage(url);
chunkRGB.fromImage(img);
this.store.dispatch(receiveBigChunk(center));
this.store.dispatch(receiveBigChunk(center, chunkRGB));
} catch (error) {
this.store.dispatch(receiveBigChunkFailure(center, error.message));
if (historicalTime) {
@ -290,7 +290,7 @@ class ChunkLoader {
} else {
throw new Error('Chunk response was invalid');
}
this.store.dispatch(receiveBigChunk(center));
this.store.dispatch(receiveBigChunk(center, chunkRGB));
} else {
throw new Error('Network response was not ok.');
}
@ -308,7 +308,7 @@ class ChunkLoader {
const url = `/tiles/${this.canvasId}/${zoom}/${cx}/${cy}.webp`;
const img = await loadImage(url);
chunkRGB.fromImage(img);
this.store.dispatch(receiveBigChunk(center));
this.store.dispatch(receiveBigChunk(center, chunkRGB));
} catch (error) {
this.store.dispatch(receiveBigChunkFailure(center, error.message));
chunkRGB.empty();

View File

@ -109,16 +109,6 @@ class ChunkLoader {
this.store.dispatch(receiveBigChunkFailure(center, error));
}
}
/*
// sine environment creation for load tests
async fetchChunk(xc, zc, chunk) {
const { key } = chunk;
console.log(`Fetch chunk ${key}`);
await chunk.generateSin();
this.store.dispatch(receiveBigChunk(key));
}
*/
}
export default ChunkLoader;