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(
|
export function receiveBigChunk(
|
||||||
center,
|
center,
|
||||||
|
chunk,
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
type: 'REC_BIG_CHUNK',
|
type: 'REC_BIG_CHUNK',
|
||||||
center,
|
center,
|
||||||
|
chunk,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ class ChunkLoader {
|
||||||
try {
|
try {
|
||||||
const img = await loadImage(url);
|
const img = await loadImage(url);
|
||||||
chunkRGB.fromImage(img);
|
chunkRGB.fromImage(img);
|
||||||
this.store.dispatch(receiveBigChunk(center));
|
this.store.dispatch(receiveBigChunk(center, chunkRGB));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.store.dispatch(receiveBigChunkFailure(center, error.message));
|
this.store.dispatch(receiveBigChunkFailure(center, error.message));
|
||||||
if (historicalTime) {
|
if (historicalTime) {
|
||||||
|
@ -290,7 +290,7 @@ class ChunkLoader {
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Chunk response was invalid');
|
throw new Error('Chunk response was invalid');
|
||||||
}
|
}
|
||||||
this.store.dispatch(receiveBigChunk(center));
|
this.store.dispatch(receiveBigChunk(center, chunkRGB));
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Network response was not ok.');
|
throw new Error('Network response was not ok.');
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ class ChunkLoader {
|
||||||
const url = `/tiles/${this.canvasId}/${zoom}/${cx}/${cy}.webp`;
|
const url = `/tiles/${this.canvasId}/${zoom}/${cx}/${cy}.webp`;
|
||||||
const img = await loadImage(url);
|
const img = await loadImage(url);
|
||||||
chunkRGB.fromImage(img);
|
chunkRGB.fromImage(img);
|
||||||
this.store.dispatch(receiveBigChunk(center));
|
this.store.dispatch(receiveBigChunk(center, chunkRGB));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.store.dispatch(receiveBigChunkFailure(center, error.message));
|
this.store.dispatch(receiveBigChunkFailure(center, error.message));
|
||||||
chunkRGB.empty();
|
chunkRGB.empty();
|
||||||
|
|
|
@ -109,16 +109,6 @@ class ChunkLoader {
|
||||||
this.store.dispatch(receiveBigChunkFailure(center, error));
|
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;
|
export default ChunkLoader;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user