summaryrefslogtreecommitdiff
path: root/src/scripts/controllers/modes/building.ts
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-01-26 23:11:29 +0100
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-01-26 23:11:29 +0100
commit027b379cf9d53a12782781e586f79051461ab661 (patch)
tree2a7601dce3b02b8e6984a9206849b97770ae585d /src/scripts/controllers/modes/building.ts
parent45a1bdae27115974568fe8cfaff7c190d1963e28 (diff)
Refactor controllers to use 'const' when possible
Diffstat (limited to 'src/scripts/controllers/modes/building.ts')
-rw-r--r--src/scripts/controllers/modes/building.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/scripts/controllers/modes/building.ts b/src/scripts/controllers/modes/building.ts
index 4d82f090..217f5935 100644
--- a/src/scripts/controllers/modes/building.ts
+++ b/src/scripts/controllers/modes/building.ts
@@ -22,7 +22,7 @@ export class BuildingModeController {
* Connects all DOM event listeners to their respective element targets.
*/
public setupEventListeners() {
- let resetConstructionButtons = () => {
+ const resetConstructionButtons = () => {
this.mapController.interactionMode = InteractionMode.DEFAULT;
this.mapView.hoverLayer.setHoverTileVisibility(false);
$("#room-construction").text("Construct new room");
@@ -79,7 +79,7 @@ export class BuildingModeController {
* @param position The new tile position to be added
*/
public addSelectedTile(position: IGridPosition): void {
- let tile = {
+ const tile = {
id: -1,
roomId: this.newRoomId,
position: {x: position.x, y: position.y}
@@ -96,11 +96,10 @@ export class BuildingModeController {
* @param position The position of the tile to be removed
*/
public removeSelectedTile(position: IGridPosition): void {
- let tile;
let objectIndex = -1;
for (let i = 0; i < this.mapView.roomLayer.selectedTileObjects.length; i++) {
- tile = this.mapView.roomLayer.selectedTileObjects[i];
+ const tile = this.mapView.roomLayer.selectedTileObjects[i];
if (tile.position.x === position.x && tile.position.y === position.y) {
objectIndex = i;
}
@@ -111,4 +110,4 @@ export class BuildingModeController {
this.mapView.roomLayer.removeSelectedTile(position, objectIndex);
});
}
-} \ No newline at end of file
+}