Skip to content

Commit a37d52f

Browse files
committed
modify the engine mouse code to only capture the mouse position while on the canvus, if off canvas, return last know posistion
1 parent 512ce26 commit a37d52f

6 files changed

Lines changed: 29 additions & 66 deletions

File tree

docs/dev/codex_commands.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
MODEL: GPT-5.3-codex
2-
REASONING: medium
2+
REASONING: low
33

44
COMMAND:
5-
Apply header/intro STRUCTURE from index pages to all /games/<game>/index.html pages.
5+
Correct the Asteroids sample launch targets only.
6+
Ensure the card uses exactly:
7+
- /games/Asteroids/index.html
8+
- /games/Asteroids/index.html?debug=1
69

7-
STRICT:
8-
- Do NOT change or set any colors
9-
- Do NOT modify CSS tokens
10-
- Only reuse structure and existing classes
11-
- No changes outside header section
12-
- Preserve all existing game functionality
13-
14-
Update roadmap status if execution-backed.
15-
Write validation report under docs/dev/reports.
10+
Do not reference asteroids_new anywhere.
11+
Do not change other samples, asset files, or layout.
12+
Update roadmap status only if this execution is test-backed and appropriate.
13+
Write validation findings under docs/dev/reports.

docs/dev/commit_comment.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
Apply header structure parity to all game detail pages.
2-
No color or style changes. Structure reuse only.
1+
Correct Asteroids sample play/debug links to existing game path.
2+
Remove incorrect target usage that referenced nonexistent asteroids_new assets.
3+
Scoped fix only.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Validation Checklist
22

3-
- [ ] All game pages include header structure
4-
- [ ] Header overlays correctly
5-
- [ ] No color changes introduced
6-
- [ ] No regressions in gameplay
7-
- [ ] No layout issues
3+
- [ ] Asteroids Play link resolves to /games/Asteroids/index.html
4+
- [ ] Asteroids Debug link resolves to /games/Asteroids/index.html?debug=1
5+
- [ ] No asteroids_new reference remains in the Asteroids sample link target
6+
- [ ] No other sample cards changed
7+
- [ ] No duplicate Asteroids launch links

src/engine/input/InputService.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,13 @@ export default class InputService {
169169
}
170170

171171
onMouseMove(event) {
172+
const eventTarget = event?.target ?? null;
173+
const isCanvasTarget = typeof HTMLCanvasElement !== 'undefined'
174+
&& eventTarget instanceof HTMLCanvasElement;
175+
if (!isCanvasTarget) {
176+
return;
177+
}
178+
172179
const nextX = event.offsetX ?? event.clientX ?? 0;
173180
const nextY = event.offsetY ?? event.clientY ?? 0;
174181
this.mouseDelta.x += nextX - this.mousePosition.x;
Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,6 @@
1-
import { createToolboxAidHeader } from './index.js';
1+
import { mountToolboxAidHeader } from './index.js';
22

3-
const mountRoot = document.getElementById('shared-theme-header-root') || document.getElementById('shared-theme-header');
4-
if (mountRoot) {
5-
const shell = document.createElement('details');
6-
shell.className = 'is-collapsible';
7-
shell.open = true;
8-
9-
const summary = document.createElement('summary');
10-
summary.className = 'is-collapsible__summary';
11-
summary.textContent = 'Header and Intro';
12-
13-
const content = document.createElement('div');
14-
content.className = 'is-collapsible__content';
15-
16-
const headerTarget = document.createElement('div');
17-
headerTarget.id = 'shared-theme-header';
18-
19-
const introMain = document.createElement('main');
20-
introMain.className = 'page-shell';
21-
22-
const introSection = document.createElement('section');
23-
introSection.className = 'page-intro';
24-
25-
const introTitle = document.createElement('h1');
26-
introTitle.className = 'page-intro-title';
27-
28-
const introDetails = document.createElement('p');
29-
introDetails.className = 'page-intro-details';
30-
31-
introSection.append(introTitle, introDetails);
32-
introMain.append(introSection);
33-
content.append(headerTarget, introMain);
34-
shell.append(summary, content);
35-
36-
mountRoot.replaceWith(shell);
37-
38-
createToolboxAidHeader().then((headerNode) => {
39-
headerTarget.prepend(headerNode);
40-
const body = document.body;
41-
const fallbackTitle = document.querySelector('body > main h1');
42-
const fallbackDetails = document.querySelector('body > main p');
43-
const title = body.dataset.headerTitle || fallbackTitle?.textContent?.trim() || '';
44-
const details = body.dataset.headerDetails || fallbackDetails?.textContent?.trim() || '';
45-
46-
introTitle.textContent = title;
47-
introDetails.textContent = details;
48-
});
3+
const target = document.getElementById('shared-theme-header');
4+
if (target) {
5+
mountToolboxAidHeader(target);
496
}

src/engine/theme/toolboxaid-header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async function loadTemplate() {
5353
const templateUrl = new URL('./toolboxaid-header.html', import.meta.url);
5454
const response = await fetch(templateUrl);
5555
if (!response.ok) {
56-
throw new Error('Failed to load src/engine/theme/toolboxaid-header.html');
56+
throw new Error('Failed to load toolboxaid-header.html');
5757
}
5858

5959
templateCache = await response.text();

0 commit comments

Comments
 (0)