Skip to content
Snippets Groups Projects
Commit 0fa4ca36 authored by Leonardo Christino's avatar Leonardo Christino
Browse files

fix(form): fix nodelink viewport resizing

parent 3cb1382e
No related branches found
No related tags found
1 merge request!48fix: fixes to the nodelink viewport resizing and database forms
Pipeline #127059 passed
......@@ -43,11 +43,23 @@ export const NLPixi = (props: Props) => {
// app.render();
// }, [props.windowSize]);
function resize() {
const width = ref?.current?.clientWidth || 1000;
const height = ref?.current?.clientHeight || 1000;
app.renderer.resize(width, height);
if (viewport.current) {
viewport.current.screenWidth = width;
viewport.current.worldWidth = width;
viewport.current.worldHeight = height;
viewport.current.screenHeight = height;
}
app.render();
}
useEffect(() => {
if (!ref.current) return;
const resizeObserver = new ResizeObserver(() => {
app.renderer.resize(ref?.current?.clientWidth || 1000, ref?.current?.clientHeight || 1000);
app.render();
resize();
});
resizeObserver.observe(ref.current);
return () => resizeObserver.disconnect(); // clean up
......@@ -56,8 +68,7 @@ export const NLPixi = (props: Props) => {
useEffect(() => {
if (ref.current && ref.current.children.length === 0) {
ref.current.appendChild(app.view as HTMLCanvasElement);
app.renderer.resize(ref?.current?.clientWidth || 1000, ref?.current?.clientHeight || 1000);
app.render();
resize();
}
}, [ref]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment