From 936d0236f994671882a8dd4b781b95cdfb68f0c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com> Date: Fri, 28 Oct 2022 20:36:35 +0100 Subject: [PATCH] feat: new fullscreen --- examples/web/react/app.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/web/react/app.tsx b/examples/web/react/app.tsx index a656d73a..94a03925 100644 --- a/examples/web/react/app.tsx +++ b/examples/web/react/app.tsx @@ -68,10 +68,13 @@ export const App: FC<AppProps> = ({ emulator, backgrounds = ["264653"] }) => { const onResetClick = () => { emulator.reset(); }; + const onFullscreenClick = () => { + setFullscreen((!fullscreen); + }; const onThemeClick = () => { setBackgroundIndex((backgroundIndex + 1) % backgrounds.length); }; - const onDrawHAndler = (handler: DrawHandler) => { + const onDrawHandler = (handler: DrawHandler) => { setInterval(() => { handler(emulator.getImageBuffer(), PixelFormat.RGB); }, 1000); @@ -90,7 +93,7 @@ export const App: FC<AppProps> = ({ emulator, backgrounds = ["264653"] }) => { <PanelSplit left={ <div> - <Display fullscreen={fullscreen} onDrawHandler={onDrawHAndler} /> + <Display fullscreen={fullscreen} onDrawHandler={onDrawHandler} /> </div> } > @@ -148,6 +151,12 @@ export const App: FC<AppProps> = ({ emulator, backgrounds = ["264653"] }) => { imageAlt="reset" onClick={onResetClick} /> + <Button + text={"Fullscreen"} + image={require("../res/maximise.svg")} + imageAlt="maximise" + onClick={onFullscreenClick} + /> <Button text={"Theme"} image={require("../res/marker.svg")} -- GitLab