fix more eslint errors

This commit is contained in:
HF 2020-01-03 15:24:40 +01:00
parent b6094e8d7f
commit 7a42e24e6b
3 changed files with 11 additions and 7 deletions

View File

@ -82,6 +82,7 @@ async function oauth_login(email, name, discordid = null) {
while (reguser) { while (reguser) {
// name is taken by someone else // name is taken by someone else
name = `${name.substring(0, 15)}-${Math.random().toString(36).substring(2, 10)}`; name = `${name.substring(0, 15)}-${Math.random().toString(36).substring(2, 10)}`;
// eslint-disable-next-line no-await-in-loop
reguser = await RegUser.findOne({ where: { name } }); reguser = await RegUser.findOne({ where: { name } });
} }
reguser = await RegUser.create({ reguser = await RegUser.create({

View File

@ -8,8 +8,11 @@ import { TILE_SIZE, TILE_LOADING_IMAGE } from '../core/constants';
import loadImage from './loadImage'; import loadImage from './loadImage';
export let loadingTile = null; export const loadingTile = {
loadImage(TILE_LOADING_IMAGE).then((img) => { loadingTile = img; }); url: TILE_LOADING_IMAGE,
img: null,
};
loadImage(TILE_LOADING_IMAGE).then((img) => { loadingTile.img = img; });
class ChunkRGB { class ChunkRGB {
@ -66,8 +69,8 @@ class ChunkRGB {
return; return;
} }
} }
if (loadingTile) { if (loadingTile.img) {
ctx.drawImage(loadingTile, 0, 0); ctx.drawImage(loadingTile.img, 0, 0);
return; return;
} else { } else {
ctx.fillStyle = this.palette.colors[2]; ctx.fillStyle = this.palette.colors[2];

View File

@ -205,7 +205,7 @@ class Renderer {
if (chunk.ready) { if (chunk.ready) {
context.drawImage(chunk.image, x, y); context.drawImage(chunk.image, x, y);
if (fetch) chunk.timestamp = curTime; if (fetch) chunk.timestamp = curTime;
} else if (loadingTile) context.drawImage(loadingTile, x, y); } else if (loadingTile.img) context.drawImage(loadingTile.img, x, y);
else context.fillRect(x, y, TILE_SIZE, TILE_SIZE); else context.fillRect(x, y, TILE_SIZE, TILE_SIZE);
} else { } else {
// we don't have that chunk // we don't have that chunk
@ -216,7 +216,7 @@ class Renderer {
store.dispatch(fetchTile(canvasId, [tiledZoom, cx, cy])); store.dispatch(fetchTile(canvasId, [tiledZoom, cx, cy]));
} }
} }
if (loadingTile) context.drawImage(loadingTile, x, y); if (loadingTile.img) context.drawImage(loadingTile.img, x, y);
else context.fillRect(x, y, TILE_SIZE, TILE_SIZE); else context.fillRect(x, y, TILE_SIZE, TILE_SIZE);
} }
} }
@ -248,7 +248,7 @@ class Renderer {
if (!view || canvasId === null) return; if (!view || canvasId === null) return;
if (this.canvasId != canvasId) { if (this.canvasId !== canvasId) {
const { canvasSize, palette, canvasMaxTiledZoom } = state.canvas; const { canvasSize, palette, canvasMaxTiledZoom } = state.canvas;
this.canvasSize = canvasSize; this.canvasSize = canvasSize;
this.palette = palette; this.palette = palette;