Skip to content

Commit

Permalink
Merge branch '404-playback-frames'
Browse files Browse the repository at this point in the history
  • Loading branch information
charlielee committed Aug 12, 2022
2 parents c93a7e7 + 80a8ca3 commit e15b3bb
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const PreviewFrame = ({ src, hidden }: PreviewFrameProps): JSX.Element => {
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });

useEffect(() => {
if (!canvasRef.current) {
const context = canvasRef.current?.getContext("2d");
if (!context) {
return;
}

const image = new Image();
image.src = src;
const context = canvasRef.current.getContext("2d");
context?.drawImage(image, 0, 0);
setDimensions({ width: image.naturalWidth, height: image.naturalHeight });
}, [src]);
Expand Down

0 comments on commit e15b3bb

Please sign in to comment.