Skip to content

Commit

Permalink
Update svg-viewer.component.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
geoyogesh committed Oct 5, 2020
1 parent 8dd860d commit bd1bba9
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { AfterViewInit, Component, ElementRef, HostListener, OnInit, ViewChild } from '@angular/core';
import { AfterViewInit, Component, ElementRef, HostListener, OnDestroy, OnInit, ViewChild } from '@angular/core';
import * as svgPanZoom from 'svg-pan-zoom';

@Component({
selector: 'capx-svg-viewer',
templateUrl: './svg-viewer.component.html',
styleUrls: ['./svg-viewer.component.scss']
})
export class SvgViewerComponent implements OnInit, AfterViewInit {
export class SvgViewerComponent implements OnInit, AfterViewInit, OnDestroy {

constructor() { }

Expand Down Expand Up @@ -34,4 +34,10 @@ export class SvgViewerComponent implements OnInit, AfterViewInit {
}
}

ngOnDestroy(): void {
if (this.svgPanZoom) {
this.svgPanZoom.destroy();
this.svgPanZoom = null;
}
}
}

0 comments on commit bd1bba9

Please sign in to comment.