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:
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user