Add in-app pixel editor for sprites in admin UI

Build a dependency-free Canvas2D pixel editor integrated into the admin
Sprites tab. Each sprite card gains an EDIT button that opens a full-screen
editor for the sprite at its native 500x333 resolution.

Tools: pencil (1-8px brush, Bresenham interpolation), eraser, color picker
(palette + native input + pick-from-canvas), fill bucket (flood fill), pan.
Features: cursor-centered zoom, space-drag pan, undo/redo (snapshot per
stroke), pixel grid overlay, transparency checkerboard, load existing sprite,
and keyboard shortcuts (B/E/I/F, Space, +/-/0, Ctrl+Z/Y, G, Esc).

Export reuses the existing POST /api/admin/sprites/{type} upload endpoint via
srcCanvas.toBlob, so no server changes are required.

Closes #5

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
root
2026-06-08 15:39:31 -07:00
parent b271c15267
commit 3f62661ed7
5 changed files with 973 additions and 0 deletions
+1
View File
@@ -265,6 +265,7 @@
<div id="toast" class="toast hidden"></div>
</div>
<script src="/admin/pixel-editor.js"></script>
<script src="/admin/admin.js"></script>
</body>
</html>