Skip to content

Commit

Permalink
Merge pull request #83 from memgraph/release/0.4.2
Browse files Browse the repository at this point in the history
Chore: Add release 0.4.2
  • Loading branch information
tonilastre authored Dec 15, 2023
2 parents 8e0a687 + 87b574c commit 8b3dd06
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.4.2

### Fix

* Fix: resizeObserver is not unobserved (#82) (fixes #81) - by @markusnissl

## 0.4.1

### Fix
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@memgraph/orb",
"version": "0.4.1",
"version": "0.4.2",
"description": "Graph visualization library",
"engines": {
"node": ">=16.0.0"
Expand Down
6 changes: 4 additions & 2 deletions src/views/default-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type IDefaultViewSettingsInit<N extends INodeBase, E extends IEdgeBase> =

export class DefaultView<N extends INodeBase, E extends IEdgeBase> implements IOrbView<IDefaultViewSettings<N, E>> {
private _container: HTMLElement;
private _resizeObs: ResizeObserver;
private _graph: IGraph<N, E>;
private _events: OrbEmitter<N, E>;
private _strategy: IEventStrategy<N, E>;
Expand Down Expand Up @@ -96,8 +97,8 @@ export class DefaultView<N extends INodeBase, E extends IEdgeBase> implements IO
this._settings.render = this._renderer.getSettings();

// Resize the canvas based on the dimensions of its parent container <div>.
const resizeObs = new ResizeObserver(() => this._handleResize());
resizeObs.observe(this._container);
this._resizeObs = new ResizeObserver(() => this._handleResize());
this._resizeObs.observe(this._container);
this._handleResize();

this._d3Zoom = zoom<HTMLCanvasElement, any>()
Expand Down Expand Up @@ -215,6 +216,7 @@ export class DefaultView<N extends INodeBase, E extends IEdgeBase> implements IO
}

destroy() {
this._resizeObs.unobserve(this._container);
this._renderer.removeAllListeners();
this._simulator.terminate();
this._canvas.outerHTML = '';
Expand Down
6 changes: 4 additions & 2 deletions src/views/map-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export type IMapViewSettingsUpdate<N extends INodeBase, E extends IEdgeBase> = P

export class MapView<N extends INodeBase, E extends IEdgeBase> implements IOrbView<IMapViewSettings<N, E>> {
private _container: HTMLElement;
private _resizeObs: ResizeObserver;
private _graph: IGraph<N, E>;
private _events: OrbEmitter<N, E>;
private _strategy: IEventStrategy<N, E>;
Expand Down Expand Up @@ -106,8 +107,8 @@ export class MapView<N extends INodeBase, E extends IEdgeBase> implements IOrbVi
this._settings.render = this._renderer.getSettings();

// Resize the canvas based on the dimensions of it's parent container <div>.
const resizeObs = new ResizeObserver(() => this._handleResize());
resizeObs.observe(this._container);
this._resizeObs = new ResizeObserver(() => this._handleResize());
this._resizeObs.observe(this._container);
this._handleResize();

this._leaflet = this._initLeaflet();
Expand Down Expand Up @@ -166,6 +167,7 @@ export class MapView<N extends INodeBase, E extends IEdgeBase> implements IOrbVi
}

destroy() {
this._resizeObs.unobserve(this._container);
this._renderer.removeAllListeners();
this._leaflet.off();
this._leaflet.remove();
Expand Down

0 comments on commit 8b3dd06

Please sign in to comment.