mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
Fix lint, use of sync method in web UI
This commit is contained in:
1 parent
c4d4cb3afd
commit
70ef8a60ad
3 files changed
+36
-30
No files matched your search
@@ -69,12 +69,18 @@ const CHUNK_SIZE = 32; // 32x32 pixels per chunk
|
||||
const TILE_SIZE = 256; // 256x256 pixels per tile (8x8 chunks)
|
||||
const CHUNKS_PER_TILE = 8;
|
||||
|
||||
const inflateAsync = (data: Uint8Array): Promise<Uint8Array> => new Promise((resolve, reject) => {
|
||||
zlib.inflate(data, (err, result) => {
|
||||
if (err) { reject(err); }
|
||||
resolve(result);
|
||||
});
|
||||
});
|
||||
|
||||
// Convert raw chart data to ImageData
|
||||
async function chartDataToImageData(chartData: string): Promise<ImageData> {
|
||||
// Decode base64 and decompress
|
||||
const compressedData = Buffer.from(chartData, "base64");
|
||||
const decompressed = zlib.inflateSync(compressedData);
|
||||
const decompressed = Buffer.from(await inflateAsync(compressedData));
|
||||
|
||||
// Create RGBA image data (32x32 pixels)
|
||||
const imageData = new Uint8ClampedArray(32 * 32 * 4);
|
||||
|
||||
Reference in new issue
Block a user