fix canvas width/height being bad on chrome

This commit is contained in:
dylan 2024-04-02 08:50:21 -07:00
parent 2cf11a3f36
commit 2b614dcb79
2 changed files with 6 additions and 1 deletions

View File

@ -8,7 +8,7 @@
- [x] Update GH Workflow to be by push - [x] Update GH Workflow to be by push
## Next ## Next
- [ ] Fix css bug on chromium - [x] Fix css bug on chromium
- [ ] Add user page to show all projects - [ ] Add user page to show all projects
## Later ## Later

View File

@ -18,6 +18,11 @@ export const Pico8Console = forwardRef((props: { carts: PicoCart[] }, forwardedR
picoConsole.canvas.tabIndex=0; picoConsole.canvas.tabIndex=0;
if (ref.current) { if (ref.current) {
ref.current.appendChild(picoConsole.canvas); ref.current.appendChild(picoConsole.canvas);
// Set the width and height because pico8 adds them as properties on chrome-based browsers
picoConsole.canvas.style.width = "";
picoConsole.canvas.style.height = "";
picoConsole.canvas.focus(); picoConsole.canvas.focus();
} }
setHandle(picoConsole); setHandle(picoConsole);