diff --git a/frontend/apps/editor3d/app/src/pages/PageDraw/PageDraw.tsx b/frontend/apps/editor3d/app/src/pages/PageDraw/PageDraw.tsx index 4c654cddb4..e626c1c9cc 100644 --- a/frontend/apps/editor3d/app/src/pages/PageDraw/PageDraw.tsx +++ b/frontend/apps/editor3d/app/src/pages/PageDraw/PageDraw.tsx @@ -196,6 +196,26 @@ const PageDraw = () => { } }; + const onFitPressed = async () => { + // Get the stage and its container dimensions + const stage = stageRef.current; + + // Get container dimensions + const containerWidth = stage.container().offsetWidth; + const containerHeight = stage.container().offsetHeight; + + // Get canvas dimensions from store aspect ratio + const canvasW = store.getAspectRatioDimensions().width; + const canvasH = store.getAspectRatioDimensions().height; + + // Calculate position to center canvas in container + stage.position({ + x: (containerWidth - canvasW) / 2, + y: (containerHeight - canvasH) / 2 + }); + + } + return ( <>