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
1 changed files with 6 additions and 0 deletions

View File

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