rete icon indicating copy to clipboard operation
rete copied to clipboard

Editor is not rendered until window resized

Open serberm opened this issue 5 years ago • 2 comments

I'm using Angular 7.1.4. If I use editor inside components it renders ok, but if pass editor as child to another components with ng-content it does not render Nodes inside editor until window is resized. As a workaround I tried to trigger window resize in ngOnInit:

setTimeout(() => {
            window.dispatchEvent(new Event('resize'));
        });

and it renders nodes but do not render connection lines between sockets

serberm avatar Jan 30 '21 04:01 serberm

Does the parent element of Rete's container have fixed sizes? Probably at the initialization of the editor, the parent element has zero sizes

Ni55aN avatar Jan 30 '21 18:01 Ni55aN

Yep, you are right, it had zero sizes. I was initializing container in ngAfterViewInit and found out that not all style properties are attached after ngAfterViewInit event. So the fix was to set timeout

setTimeout(() => { const container = this.el.nativeElement; let editor = new NodeEditor("[email protected]", container); ... }, 10);

serberm avatar Jan 30 '21 19:01 serberm

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

rete-js[bot] avatar Jul 13 '23 10:07 rete-js[bot]