Skip to content

Commit

Permalink
fix: prettier errors
Browse files Browse the repository at this point in the history
  • Loading branch information
r0man1337 committed Sep 26, 2024
1 parent 25ca968 commit d528691
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 24 deletions.
13 changes: 11 additions & 2 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down Expand Up @@ -85,7 +85,16 @@
id="minimap"
width="200"
height="112"
style="position: absolute; top: 10px; right: 10px; border: 1px solid rgba(0, 0, 0, 0.3);background-color: rgba(0, 0, 0, 0.3); border-radius: 5px; z-index: 1000; display: none;"
style="
position: absolute;
top: 10px;
right: 10px;
border: 1px solid rgba(0, 0, 0, 0.3);
background-color: rgba(0, 0, 0, 0.3);
border-radius: 5px;
z-index: 1000;
display: none;
"
></canvas>
<script type="module" src="/src/main.tsx"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion client/src/three/SceneManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { HexagonScene } from "./scenes/HexagonScene";
export class SceneManager {
private currentScene: SceneName | undefined = undefined;
private scenes = new Map<SceneName, HexagonScene>();
constructor(private transitionManager: TransitionManager) { }
constructor(private transitionManager: TransitionManager) {}

getCurrentScene() {
return this.currentScene;
Expand Down
28 changes: 14 additions & 14 deletions client/src/three/components/Minimap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const MINIMAP_CONFIG = {
HEIGHT_FACTOR: 13,
},
},
BORDER_WIDTH_PERCENT: 0.10,
BORDER_WIDTH_PERCENT: 0.1,
};

class Minimap {
Expand All @@ -46,7 +46,7 @@ class Minimap {
private scaleY: number;
private isDragging: boolean = false;
private biomeCache: Map<string, string>;
private scaledCoords: Map<string, { scaledCol: number, scaledRow: number }>;
private scaledCoords: Map<string, { scaledCol: number; scaledRow: number }>;
private BORDER_WIDTH_PERCENT = MINIMAP_CONFIG.BORDER_WIDTH_PERCENT;

constructor(
Expand Down Expand Up @@ -208,17 +208,17 @@ class Minimap {
private handleMouseDown = (event: MouseEvent) => {
this.isDragging = true;
this.moveCamera(event);
}
};

private handleMouseMove = (event: MouseEvent) => {
if (this.isDragging) {
this.moveCamera(event);
}
}
};

private handleMouseUp = () => {
this.isDragging = false;
}
};

private moveCamera(event: MouseEvent) {
const { col, row } = this.getMousePosition(event);
Expand All @@ -230,19 +230,19 @@ class Minimap {
const rowShift = (this.displayRange.maxRow - this.displayRange.minRow) / 4;

switch (direction) {
case 'left':
case "left":
this.displayRange.minCol -= colShift;
this.displayRange.maxCol -= colShift;
break;
case 'right':
case "right":
this.displayRange.minCol += colShift;
this.displayRange.maxCol += colShift;
break;
case 'top':
case "top":
this.displayRange.minRow -= rowShift;
this.displayRange.maxRow -= rowShift;
break;
case 'bottom':
case "bottom":
this.displayRange.minRow += rowShift;
this.displayRange.maxRow += rowShift;
break;
Expand All @@ -263,16 +263,16 @@ class Minimap {
const borderWidthY = this.canvas.height * this.BORDER_WIDTH_PERCENT;

if (x < borderWidthX) {
this.moveMapRange('left');
this.moveMapRange("left");
} else if (x > this.canvas.width - borderWidthX) {
this.moveMapRange('right');
this.moveMapRange("right");
} else if (y < borderWidthY) {
this.moveMapRange('top');
this.moveMapRange("top");
} else if (y > this.canvas.height - borderWidthY) {
this.moveMapRange('bottom');
this.moveMapRange("bottom");
}
this.worldmapScene.moveCameraToColRow(col, row, 0);
}
};
}

export default Minimap;
2 changes: 1 addition & 1 deletion client/src/three/scenes/HexagonScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ export abstract class HexagonScene {
mesh.position.set(x, -0.05, z);
mesh.receiveShadow = true;
// disable raycast
mesh.raycast = () => { };
mesh.raycast = () => {};

this.scene.add(mesh);
}
Expand Down
8 changes: 4 additions & 4 deletions client/src/three/scenes/Hexception.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default class HexceptionScene extends HexagonScene {
this.modelLoadPromises.push(loadPromise);
}

Promise.all(this.modelLoadPromises).then(() => { });
Promise.all(this.modelLoadPromises).then(() => {});
}

setup() {
Expand Down Expand Up @@ -218,7 +218,7 @@ export default class HexceptionScene extends HexagonScene {
this.moveCameraToURLLocation();
}

onSwitchOff() { }
onSwitchOff() {}

protected onHexagonClick(hexCoords: HexPosition | null): void {
if (hexCoords === null) return;
Expand Down Expand Up @@ -271,8 +271,8 @@ export default class HexceptionScene extends HexagonScene {
this.buildingPreview?.resetBuildingColor();
}
}
protected onHexagonRightClick(): void { }
protected onHexagonDoubleClick(): void { }
protected onHexagonRightClick(): void {}
protected onHexagonDoubleClick(): void {}

public moveCameraToURLLocation() {
this.moveCameraToColRow(10, 10, 0);
Expand Down
11 changes: 9 additions & 2 deletions client/src/three/scenes/Worldmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,14 @@ export default class WorldmapScene extends HexagonScene {
},
);

this.minimap = new Minimap(this, this.exploredTiles, this.camera, this.structureManager, this.armyManager, this.biome);
this.minimap = new Minimap(
this,
this.exploredTiles,
this.camera,
this.structureManager,
this.armyManager,
this.biome,
);

// Add event listener for Escape key
document.addEventListener("keydown", (event) => {
Expand Down Expand Up @@ -252,7 +259,7 @@ export default class WorldmapScene extends HexagonScene {
this.state.setLeftNavigationView(View.EntityView);
}
}
protected onHexagonRightClick(): void { }
protected onHexagonRightClick(): void {}

private onArmySelection(selectedEntityId: ID | undefined) {
if (!selectedEntityId) {
Expand Down

0 comments on commit d528691

Please sign in to comment.