Resize function stretch the canvas instead of resizing
Hi and thanks for this very good development!
I am trying to include three-dxf in a React component and making it responsive. I managed to achieve that by deleting the previous canvas and rendering a new one but I noticed you wrote a function resize for the renderer: https://github.com/gdsestimating/three-dxf/blob/20e14cbd13735e16a1b691f7b864936dd688fb74/src/index.js#L176
I gave it a try since it would save some processing not having to redraw the dxf but I only see the canvas being stretch, it doesn't keep the aspect ratio and when I zoom or move, it goes back to the previous size. It seems like it doesn't update the camera parameters, but I am really not an expert with three.js
Hi. If you still need any help
You need to call instance on ThreeDxf.Viewer something like
dxfViewer.renderer.setSize(width, height);
and then update that with
dxfViewer.render(scene, camera)
Plus I think you have to write your resize method / function with eventListener and call this in your component. You can try doing this with the resize(width, height) function of the dxfViewer. But it looks like you need to listen for the resize event.