Skip to content

Commit 40e4cd2

Browse files
authored
Merge pull request #3 from joshaber/joshaber/fixups
Fix ups
2 parents f2dc65b + a7b2b26 commit 40e4cd2

8 files changed

Lines changed: 1631 additions & 4094 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"portsAttributes": {
3-
"8080": {
3+
"3000": {
44
"label": "Application",
55
"onAutoForward": "openPreview"
66
}
77
},
88
"customizations": {
99
"codespaces": {
1010
"openFiles": [
11-
"build/app.js"
11+
"app/scripts/core/gameCoordinator.js"
1212
]
1313
}
1414
},
15-
"onCreateCommand": "npm install & npm install -g gulp",
15+
"onCreateCommand": "npm install",
1616
"postAttachCommand": {
1717
"server": "npm run serve",
18-
"watcher": "gulp watch"
18+
"watcher": "npx gulp watch"
1919
}
20-
}
20+
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/node_modules
2-
/.nyc_output
2+
/.nyc_output
3+
/build/

app/scripts/core/gameCoordinator.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ class GameCoordinator {
708708
window.addEventListener('addTimer', this.addTimer.bind(this));
709709
window.addEventListener('removeTimer', this.removeTimer.bind(this));
710710
window.addEventListener('releaseGhost', this.releaseGhost.bind(this));
711+
this.registerResizeListener();
711712

712713
const directions = ['up', 'down', 'left', 'right'];
713714

@@ -720,6 +721,22 @@ class GameCoordinator {
720721
});
721722
}
722723

724+
registerResizeListener() {
725+
let timer = null;
726+
window.addEventListener('resize', () => {
727+
if (timer) {
728+
clearTimeout(timer);
729+
timer = null;
730+
}
731+
732+
timer = setTimeout(() => {
733+
if (this.scale !== this.determineScale(1)) {
734+
window.location.reload();
735+
}
736+
}, 100);
737+
});
738+
}
739+
723740
/**
724741
* Calls Pacman's changeDirection event if certain conditions are met
725742
* @param {({'up'|'down'|'left'|'right'})} direction

0 commit comments

Comments
 (0)