forked from ppfun/pixelplanet
fix receivechunk extension hook
This commit is contained in:
parent
9e11ea3729
commit
0a4ad3a906
|
@ -229,10 +229,12 @@ export function preLoadedBigChunk(
|
|||
|
||||
export function receiveBigChunk(
|
||||
center,
|
||||
chunk,
|
||||
) {
|
||||
return {
|
||||
type: 'REC_BIG_CHUNK',
|
||||
center,
|
||||
chunk,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user