Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
phschaad committed Sep 5, 2024
1 parent c615827 commit eb78589
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/local_view/lview_renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ import { ReuseDistanceOverlay } from './overlays/reuse_distance_overlay';

export class LViewRenderer {

public readonly pixiApp: Application | null = null;
public readonly viewport: Viewport | null = null;
public readonly resizeObserver: ResizeObserver;
public readonly pixiApp: Application;
public readonly viewport: Viewport;

protected tooltipContainer?: JQuery<HTMLDivElement>;
protected tooltipText?: JQuery<HTMLSpanElement>;
Expand Down Expand Up @@ -84,7 +85,7 @@ export class LViewRenderer {
interaction: this.pixiApp.renderer.plugins.interaction,
});

const resizeObserver = new ResizeObserver(entries => {
this.resizeObserver = new ResizeObserver(entries => {
entries.forEach(entry => {
if (entry.contentBoxSize) {
this.pixiApp?.resize();
Expand All @@ -94,7 +95,7 @@ export class LViewRenderer {
}
});
});
resizeObserver.observe(this.container);
this.resizeObserver.observe(this.container);

this.pixiApp.stage.addChild(this.viewport);

Expand Down
10 changes: 7 additions & 3 deletions src/renderer/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4101,9 +4101,10 @@ export class SDFGRenderer extends EventEmitter {
if (!(this.sdfv_instance instanceof SDFV))
return;

if (this.sdfv_instance instanceof WebSDFV) {
this.container.innerHTML = '';
this.sdfv_instance.setSDFG(this.sdfg);
const sdfv = this.sdfv_instance;
if (sdfv instanceof WebSDFV) {
sdfv.setSDFG(this.sdfg);
sdfv.getLocalViewRenderer()?.resizeObserver.disconnect();
}
}

Expand Down Expand Up @@ -4139,6 +4140,9 @@ export class SDFGRenderer extends EventEmitter {
this.container.appendChild(exitBtn);

this.sdfv_instance.setLocalViewRenderer(lRenderer);

if (this.canvas)
$(this.canvas).remove();
}
} catch (e) {
if (e instanceof LViewGraphParseError)
Expand Down

0 comments on commit eb78589

Please sign in to comment.