Skip to content

Commit 1e95d54

Browse files
author
DavidQ
committed
BUILD_PR_SPRITE_EDITOR_USABILITY_POLISH: implement approved usability improvements for isolated Sprite Editor without expanding scope
1 parent c5136ab commit 1e95d54

10 files changed

Lines changed: 516 additions & 128 deletions

File tree

CODEX_COMMANDS.md

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,31 @@ REASONING: high
99
COMMAND:
1010
Create BUILD_PR_SPRITE_EDITOR_USABILITY_POLISH.
1111

12+
Use docs/pr/PLAN_PR_SPRITE_EDITOR_USABILITY_POLISH.md as the approved plan source of truth.
13+
1214
Goal:
13-
Implement a small, surgical usability-polish PR for the isolated Sprite Editor now that core features are working.
15+
Implement the approved usability-polish PR for the isolated Sprite Editor only.
1416

1517
Scope rules:
16-
1. Do not review, modify, migrate, or delete any pre-existing sprite editor outside tools/Sprite Editor/
17-
2. Keep scope limited to tools/Sprite Editor/, tools/index.html only if needed, and docs/reports
18-
3. Do not expand into engine or unrelated tools
19-
4. Docs-first
20-
5. One PR per purpose
21-
6. Preserve required file headers
22-
7. No destructive changes
18+
1. Only implement the approved polish items from the plan.
19+
2. Do not expand scope beyond the approved plan.
20+
3. Do not review, modify, migrate, or delete any pre-existing sprite editor outside tools/Sprite Editor/
21+
4. Do not touch engine code or unrelated tools.
22+
5. Leave unrelated workspace modifications untouched.
23+
6. Preserve required file headers on all new files.
24+
7. Follow repo workflow and keep this PR small and surgical.
2325

24-
Polish targets:
26+
Primary implementation targets:
2527
- Better tool-state visibility for active tool / active color / active frame
26-
- Keyboard shortcuts plan (pencil, eraser, fill, grid toggle, onion skin toggle, frame next/prev)
27-
- Undo/redo implementation
28-
- Clear resize/new-canvas behavior contract messaging
28+
- Keyboard shortcuts for approved actions from the plan
29+
- Undo/redo if approved in the plan
30+
- Clear resize/new-canvas behavior based on the approved contract
2931
- Better import/export feedback messaging
3032
- Improved recent-color swatch behavior
31-
- Preview panel polish for FPS/play/pause clarity
32-
- Optional status bar (canvas size, zoom, active frame, cursor pixel position)
33-
- Mouse drag drawing reliability polish
33+
- Preview panel polish for FPS / play / pause clarity
34+
- Optional status bar if approved in the plan
35+
- Mouse interaction polish for drag drawing reliability
3436
- Save/load UX cleanup
3537

36-
Required outputs:
37-
- docs/pr/BUILD_PR_SPRITE_EDITOR_USABILITY_POLISH.md
38-
- CODEX_COMMANDS.md
39-
- docs/dev/reports/change_summary.txt
40-
- docs/dev/reports/validation_checklist.txt
41-
- docs/dev/reports/file_tree.txt
42-
4338
Packaging:
4439
- tmp/BUILD_PR_SPRITE_EDITOR_USABILITY_POLISH_delta.zip

docs/dev/reports/change_summary.txt

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,38 @@ David Quesenberry
33
04/03/2026
44
change_summary.txt
55

6-
PLAN_PR target:
7-
Create a docs-only plan bundle for Sprite Editor usability polish without implementation edits.
6+
BUILD_PR target:
7+
Implement approved usability polish for the isolated Sprite Editor using PLAN_PR_SPRITE_EDITOR_USABILITY_POLISH as source of truth.
88

9-
Planned BUILD scope (next step):
10-
- tools/Sprite Editor/** usability polish only
11-
- tools/index.html only if a tiny non-destructive update is strictly needed
12-
- docs/reports updates required by workflow
9+
Implemented areas:
10+
- tools/Sprite Editor/index.html
11+
- Added persistent state row for tool/color/frame/toggle/canvas+cursor status visibility
12+
- Added Undo/Redo controls
13+
- Updated preview controls to Play/Pause/Reset
14+
- Added usability hint text for shortcuts and resize/new-canvas behavior
15+
- tools/Sprite Editor/spriteEditor.css
16+
- Added state row and state pill styling
17+
- Added hint-text styling
18+
- Added touch-action guard on editor canvas for pointer reliability
19+
- tools/Sprite Editor/modules/constants.js
20+
- Added HISTORY_LIMIT for bounded undo/redo behavior
21+
- tools/Sprite Editor/modules/spriteEditorApp.js
22+
- Added keyboard shortcuts (P/E/F/G/O/[ / ] + Ctrl+Z/Ctrl+Y/Ctrl+Shift+Z)
23+
- Added bounded undo/redo stacks with UI controls
24+
- Added explicit resize/new-canvas behavior messaging
25+
- Added richer import/export/save/load feedback messages with file and size/frame context
26+
- Added improved recent-color handling/rendering consistency for transparent swatches
27+
- Added preview Play/Pause/Reset behavior and FPS status messages
28+
- Added status bar updates for canvas/zoom/frame/cursor
29+
- Added drag-stroke history-safe handling and pointer lifecycle reliability polish
30+
- tools/Sprite Editor/README.md
31+
- Documented usability behavior contracts and shortcuts
1332

14-
Planned polish focus:
15-
- state visibility
16-
- keyboard shortcuts
17-
- undo/redo
18-
- resize/new-canvas behavior clarity
19-
- import/export messaging clarity
20-
- recent-color polish
21-
- preview controls clarity
22-
- optional status bar telemetry
23-
- drag reliability
24-
- save/load UX cleanup
33+
Docs/build artifacts:
34+
- docs/pr/BUILD_PR_SPRITE_EDITOR_USABILITY_POLISH.md
35+
- CODEX_COMMANDS.md
2536

26-
Locked exclusions:
27-
- no engine changes
28-
- no unrelated tools
29-
- no samples/games edits
30-
- no legacy sprite-editor path modifications
31-
32-
This PLAN bundle is docs-only and contains no implementation code changes.
37+
Scope guardrails honored:
38+
- No engine changes
39+
- No unrelated tool changes
40+
- No modifications to pre-existing sprite editor implementations outside tools/Sprite Editor/

docs/dev/reports/file_tree.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ David Quesenberry
33
04/03/2026
44
file_tree.txt
55

6-
PLAN_PR_SPRITE_EDITOR_USABILITY_POLISH docs bundle file tree
6+
BUILD_PR_SPRITE_EDITOR_USABILITY_POLISH file tree
77

88
CODEX_COMMANDS.md
99
docs/pr/PLAN_PR_SPRITE_EDITOR_USABILITY_POLISH.md
10+
docs/pr/BUILD_PR_SPRITE_EDITOR_USABILITY_POLISH.md
1011
docs/dev/reports/change_summary.txt
1112
docs/dev/reports/validation_checklist.txt
1213
docs/dev/reports/file_tree.txt
14+
tools/Sprite Editor/README.md
15+
tools/Sprite Editor/index.html
16+
tools/Sprite Editor/spriteEditor.css
17+
tools/Sprite Editor/modules/constants.js
18+
tools/Sprite Editor/modules/spriteEditorApp.js

docs/dev/reports/validation_checklist.txt

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,35 @@ David Quesenberry
33
04/03/2026
44
validation_checklist.txt
55

6-
PLAN_PR_SPRITE_EDITOR_USABILITY_POLISH checklist
6+
BUILD_PR_SPRITE_EDITOR_USABILITY_POLISH validation checklist
77

8-
Docs bundle validation:
9-
[x] PLAN doc created at docs/pr/PLAN_PR_SPRITE_EDITOR_USABILITY_POLISH.md
10-
[x] CODEX_COMMANDS.md updated for BUILD_PR_SPRITE_EDITOR_USABILITY_POLISH
11-
[x] change_summary.txt updated
12-
[x] validation_checklist.txt updated
13-
[x] file_tree.txt updated
14-
[x] Bundle is docs-only (no implementation code changes)
15-
[x] Scope boundaries clearly documented
16-
[x] In-scope / out-of-scope clearly documented
17-
[x] Exact likely BUILD file list documented
18-
[x] UX behavior contract documented for each polish item
19-
[x] Manual validation checklist documented
20-
[x] BUILD command documented
21-
[x] Commit comment documented
22-
[x] Next command documented
8+
Scope and safety:
9+
[x] Changes limited to tools/Sprite Editor and docs/reports bundle files
10+
[x] No engine changes
11+
[x] No unrelated tool changes
12+
[x] No pre-existing sprite editor paths outside tools/Sprite Editor modified
2313

24-
Guardrail checks:
25-
[x] No engine scope introduced
26-
[x] No unrelated tool scope introduced
27-
[x] No legacy sprite-editor migration/refactor scope introduced
28-
[x] No destructive/deletion instructions included
14+
Usability contracts:
15+
[x] Active tool/color/frame/toggle visibility row implemented
16+
[x] Status bar includes canvas size, zoom, frame, and cursor pixel coordinates
17+
[x] Keyboard shortcuts implemented: P, E, F, G, O, [, ], Ctrl+Z, Ctrl+Y, Ctrl+Shift+Z
18+
[x] Undo/redo controls and history stack implemented
19+
[x] New canvas behavior explicitly resets document with status messaging
20+
[x] Resize behavior explicitly preserves pixels with nearest-neighbor status messaging
21+
[x] Import/export/save/load feedback messages include file and dimension/frame context
22+
[x] Recent color swatches remain deduped/newest-first and transparent swatches are visually distinct
23+
[x] Preview controls clarified to Play/Pause/Reset and FPS messaging is explicit
24+
[x] Pointer drag reliability improved with stroke-history and pointer lifecycle handling
25+
26+
Syntax checks:
27+
[x] node --check tools/Sprite Editor/modules/spriteEditorApp.js
28+
[x] node --check tools/Sprite Editor/modules/constants.js
29+
[x] node --check tools/Sprite Editor/main.js
30+
31+
Manual browser validation targets (for APPLY/QA pass):
32+
[ ] Open tools/Sprite Editor/index.html and confirm UI state row updates live
33+
[ ] Confirm all shortcuts perform expected actions
34+
[ ] Confirm undo/redo on draw/fill/frame/import/resize/new-canvas
35+
[ ] Confirm import/export/save/load messages in status panel
36+
[ ] Confirm preview play/pause/reset behavior and FPS feedback
37+
[ ] Confirm drag drawing remains reliable across fast pointer movement
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Toolbox Aid
2+
David Quesenberry
3+
04/03/2026
4+
BUILD_PR_SPRITE_EDITOR_USABILITY_POLISH.md
5+
6+
# BUILD_PR_SPRITE_EDITOR_USABILITY_POLISH
7+
8+
## Goal
9+
Implement approved usability improvements for the isolated Sprite Editor at `tools/Sprite Editor/` without expanding scope.
10+
11+
## Approved source
12+
- `docs/pr/PLAN_PR_SPRITE_EDITOR_USABILITY_POLISH.md`
13+
14+
## Implemented polish scope
15+
- Better persistent tool-state visibility:
16+
- active tool
17+
- active color
18+
- active frame
19+
- grid/onion toggle state
20+
- canvas/zoom/cursor status bar
21+
- Keyboard shortcuts:
22+
- `P`, `E`, `F`
23+
- `G`, `O`
24+
- `[` and `]`
25+
- `Ctrl+Z`, `Ctrl+Y`, `Ctrl+Shift+Z`
26+
- Undo/redo support for draw/fill/frame/import/resize/new-canvas actions
27+
- Clear resize/new-canvas behavior messaging
28+
- Import/export/save/load status feedback improvements
29+
- Recent-color swatch polish including transparent swatch styling
30+
- Preview panel control clarity (Play/Pause/Reset + FPS messaging)
31+
- Mouse drag reliability polish (history-safe stroke handling, pointer lifecycle handling)
32+
- Save/load UX clarity messages
33+
34+
## Scope boundaries honored
35+
In scope:
36+
- `tools/Sprite Editor/**`
37+
- docs/reports for this BUILD bundle
38+
39+
Out of scope:
40+
- engine changes
41+
- unrelated tools
42+
- legacy or pre-existing sprite editor implementations outside `tools/Sprite Editor/`
43+
- sample/game edits
44+
45+
## Validation summary
46+
- JS syntax checks passed for changed JS files
47+
- Shortcut bindings implemented per plan
48+
- Undo/redo stack implemented and wired
49+
- State row and status bar wired and updated during interaction
50+
- Preview controls updated to Play/Pause/Reset semantics
51+
- No engine/unrelated tool modifications in this PR scope
52+
53+
## Packaging
54+
- `tmp/BUILD_PR_SPRITE_EDITOR_USABILITY_POLISH_delta.zip`
55+
- ZIP contains only files relevant to this PR

tools/Sprite Editor/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ Standalone browser-based Sprite Editor tool built as an isolated implementation
2121
- Save/load editor project JSON
2222
- Transparent background support
2323
- Animation preview panel with FPS control
24+
- Persistent state row for active tool/color/frame/toggles + cursor position
25+
- Keyboard shortcuts: `P`, `E`, `F`, `G`, `O`, `[`, `]`, `Ctrl+Z`, `Ctrl+Y`, `Ctrl+Shift+Z`
26+
- Undo/redo history for drawing and editing actions
27+
28+
## Usability behavior contract
29+
- `Create New Canvas` resets content to a fresh single-frame document.
30+
- Width/height resize preserves existing pixels via nearest-neighbor remap.
31+
- Import/export/save/load status messages include file and size/frame context when available.
32+
- Recent color swatches are deduplicated and newest-first.
33+
- Preview controls use Play/Pause/Reset semantics with visible FPS feedback.
2434

2535
## Entry point
2636
- `tools/Sprite Editor/index.html`

tools/Sprite Editor/index.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ <h1>Sprite Editor</h1>
4949
</div>
5050
</section>
5151

52+
<section class="state-row">
53+
<p id="toolStateText" class="state-pill">Tool: Pencil</p>
54+
<p id="activeColorText" class="state-pill">Color: #ff5a5aff</p>
55+
<p id="frameStateText" class="state-pill">Frame: 1 / 1</p>
56+
<p id="toggleStateText" class="state-pill">Grid: On | Onion: Off</p>
57+
<p id="statusBarText" class="state-pill">Canvas: 32x32 | Zoom: 18 | Cursor: -, -</p>
58+
</section>
59+
5260
<section class="workspace">
5361
<div class="left-panel">
5462
<div class="panel-block">
@@ -71,8 +79,11 @@ <h2>Frames</h2>
7179
<button id="addFrameButton" type="button">Add</button>
7280
<button id="duplicateFrameButton" type="button">Duplicate</button>
7381
<button id="deleteFrameButton" type="button">Delete</button>
82+
<button id="undoButton" type="button">Undo</button>
83+
<button id="redoButton" type="button">Redo</button>
7484
</div>
7585
<p id="frameCounter" class="frame-counter">Frame 1 / 1</p>
86+
<p class="hint-text">Shortcuts: [ / ] to change frame, Ctrl+Z undo, Ctrl+Y redo.</p>
7687
<label class="inline-toggle">
7788
<input id="onionSkinToggle" type="checkbox" />
7889
Onion skin
@@ -92,6 +103,7 @@ <h2>Project I/O</h2>
92103
<button id="exportSheetButton" type="button">Export Sprite Sheet</button>
93104
<input id="importPngInput" type="file" accept="image/png" class="hidden-input" />
94105
</div>
106+
<p class="hint-text">Canvas resize preserves pixels. Create New Canvas resets to a fresh document.</p>
95107
</div>
96108
</div>
97109

@@ -107,7 +119,8 @@ <h2>Preview</h2>
107119
<canvas id="previewCanvas" aria-label="Animation preview"></canvas>
108120
<div class="preview-controls">
109121
<button id="playPreviewButton" type="button">Play</button>
110-
<button id="stopPreviewButton" type="button">Stop</button>
122+
<button id="pausePreviewButton" type="button">Pause</button>
123+
<button id="resetPreviewButton" type="button">Reset</button>
111124
</div>
112125
<label>FPS
113126
<input id="fpsInput" type="range" min="1" max="24" value="8" />
@@ -118,7 +131,7 @@ <h2>Preview</h2>
118131
<div class="panel-block">
119132
<h2>Status</h2>
120133
<p id="statusText" class="status-text">Ready.</p>
121-
<p id="toolStateText" class="status-text">Tool: Pencil</p>
134+
<p class="status-text">Shortcuts: P pencil, E eraser, F fill, G grid, O onion, [ ] frames.</p>
122135
</div>
123136
</div>
124137
</section>

tools/Sprite Editor/modules/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const DEFAULT_WIDTH = 32;
1717
export const DEFAULT_HEIGHT = 32;
1818
export const DEFAULT_PIXEL_SIZE = 18;
1919
export const DEFAULT_FPS = 8;
20+
export const HISTORY_LIMIT = 50;
2021

2122
export const MAX_RECENT_COLORS = 12;
2223

0 commit comments

Comments
 (0)