1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Change comments

This commit is contained in:
Aurumaker72 2021-03-21 15:30:54 +01:00
parent 6a346610e5
commit 0544dfc3f0

View File

@ -322,15 +322,15 @@ export class HUDMassSelector extends BaseHUDPart {
parameters.context.fillStyle = THEME.map.selectionOverlay; parameters.context.fillStyle = THEME.map.selectionOverlay;
parameters.context.beginPath(); parameters.context.beginPath();
this.selectedUids.forEach(uid => { this.selectedUids.forEach(uid => {
// Do not attempt to write this in one line, it will be much slower.
const entity = this.root.entityMgr.findByUid(uid); const entity = this.root.entityMgr.findByUid(uid);
const staticComp = entity.components.StaticMapEntity; const staticComp = entity.components.StaticMapEntity;
const bounds = staticComp.getTileSpaceBounds(); const bounds = staticComp.getTileSpaceBounds();
// tried writing this in one line: it worked but it was very slow... WHY?
parameters.context.fillRect( parameters.context.fillRect(
bounds.x * globalConfig.tileSize + boundsBorder, bounds.x * globalConfig.tileSize + boundsBorder,
bounds.y * globalConfig.tileSize + boundsBorder, bounds.y * globalConfig.tileSize + boundsBorder,
bounds.w * globalTileSizeAdjusted, bounds.w * globalTileSizeAdjusted,
bounds.h * globalTileSizeAdjusted // This seems like microoptimization but on a huuuge scale it makes a difference bounds.h * globalTileSizeAdjusted // MICROOPTIMIZATION: Avoid computing inside loops.
); );
}); });
parameters.context.closePath(); // +1 fps for some reason parameters.context.closePath(); // +1 fps for some reason