prevent duplicate writes

This commit is contained in:
Evert Prants 2022-04-02 17:38:51 +03:00
parent 31aacbf52e
commit afd5cd8441
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -37,6 +37,12 @@ export class Canvas {
const color = typeof pixel === 'string' ? storeHex(pixel) : pixel; const color = typeof pixel === 'string' ? storeHex(pixel) : pixel;
const index = to1D(x, y, this.size); const index = to1D(x, y, this.size);
// prevent duplicate writes
if (this._canvas[index] === color) {
return;
}
const record = { const record = {
user, user,
color, color,