diff --git a/webstepper/src/SvgDisplay.tsx b/webstepper/src/SvgDisplay.tsx index 99b799e..c734fb9 100644 --- a/webstepper/src/SvgDisplay.tsx +++ b/webstepper/src/SvgDisplay.tsx @@ -1,6 +1,7 @@ import React, { useRef, useEffect } from "react"; import { Paper } from "@mui/material"; import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch"; +import "./css/styles.css"; type SvgDisplayPropTypes = { svgPath: string; @@ -8,8 +9,6 @@ type SvgDisplayPropTypes = { export default function SvgDisplay(props: SvgDisplayPropTypes) { const canvasRef = useRef(null); - const canvasWidth = 1300; - const canvasHeight = 1000; useEffect(() => { const loadAndDrawSvg = async () => { @@ -19,8 +18,11 @@ export default function SvgDisplay(props: SvgDisplayPropTypes) { const image = new Image(); image.src = URL.createObjectURL(blob); image.onload = () => { - const context = canvasRef.current.getContext("2d"); + const canvas = canvasRef.current; + const context = canvas.getContext("2d"); context.clearRect(0, 0, image.width, image.height); + canvas.width = image.width; + canvas.height = image.height; context.drawImage(image, 0, 0); }; } catch (error) { @@ -32,14 +34,8 @@ export default function SvgDisplay(props: SvgDisplayPropTypes) { return (