1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Improve performance by getting rid of instanceof

This commit is contained in:
tobspr
2020-06-27 10:38:11 +02:00
parent d8bf4f9cd8
commit 419401b9be
21 changed files with 239 additions and 199 deletions

View File

@@ -2,7 +2,7 @@ import { globalConfig } from "../../core/config";
import { smoothenDpi } from "../../core/dpi_manager";
import { DrawParameters } from "../../core/draw_parameters";
import { types } from "../../savegame/serialization";
import { BaseItem } from "../base_item";
import { BaseItem, enumItemType } from "../base_item";
import { enumColors, enumColorsToHexCode } from "../colors";
import { THEME } from "../theme";
@@ -23,6 +23,10 @@ export class ColorItem extends BaseItem {
this.color = data;
}
getItemType() {
return enumItemType.color;
}
/**
* @param {enumColors} color
*/

View File

@@ -1,6 +1,6 @@
import { DrawParameters } from "../../core/draw_parameters";
import { types } from "../../savegame/serialization";
import { BaseItem } from "../base_item";
import { BaseItem, enumItemType } from "../base_item";
import { ShapeDefinition } from "../shape_definition";
import { THEME } from "../theme";
@@ -21,6 +21,10 @@ export class ShapeItem extends BaseItem {
this.definition = ShapeDefinition.fromShortKey(data);
}
getItemType() {
return enumItemType.shape;
}
/**
* @param {ShapeDefinition} definition
*/