mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-25 02:47:58 +00:00
Enable the @typescript-eslint/no-non-null-assertion eslint rule (#1899)
## Description: Enable the `@typescript-eslint/no-non-null-assertion` eslint rule. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced
This commit is contained in:
@@ -154,7 +154,9 @@ export class AnimatedSpriteLoader {
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = img.width;
|
||||
canvas.height = img.height;
|
||||
canvas.getContext("2d")!.drawImage(img, 0, 0);
|
||||
const ctx = canvas.getContext("2d");
|
||||
if (!ctx) throw new Error("2D context not supported");
|
||||
ctx.drawImage(img, 0, 0);
|
||||
|
||||
this.animatedSpriteImageMap.set(typedFxType, canvas);
|
||||
} catch (err) {
|
||||
@@ -192,10 +194,8 @@ export class AnimatedSpriteLoader {
|
||||
const borderColor = theme.borderColor(owner);
|
||||
const spawnHighlightColor = theme.spawnHighlightColor();
|
||||
const key = `${fxType}-${owner.id()}`;
|
||||
let coloredCanvas: HTMLCanvasElement;
|
||||
if (this.coloredAnimatedSpriteCache.has(key)) {
|
||||
coloredCanvas = this.coloredAnimatedSpriteCache.get(key)!;
|
||||
} else {
|
||||
let coloredCanvas = this.coloredAnimatedSpriteCache.get(key);
|
||||
if (coloredCanvas === undefined) {
|
||||
coloredCanvas = colorizeCanvas(
|
||||
baseImage,
|
||||
territoryColor,
|
||||
|
||||
Reference in New Issue
Block a user