Use Uint8Array instead of Uint8ClampedArray for browser compatibility

This commit is contained in:
Tim Schaub
2021-09-16 15:08:09 -06:00
parent c57c898381
commit 836aa4900e
3 changed files with 7 additions and 4 deletions

View File

@@ -31,7 +31,8 @@ const map = new Map({
context.fillText(`y: ${y}`, half, half + lineHeight);
context.strokeRect(0, 0, size, size);
const data = context.getImageData(0, 0, size, size).data;
return Promise.resolve(data);
// converting to Uint8Array for increased browser compatibility
return Promise.resolve(new Uint8Array(data.buffer));
},
// disable opacity transition to avoid overlapping labels during tile loading
transition: 0,