Commit 74c31db3 authored by Thomas Frion's avatar Thomas Frion
Browse files

[WIP] WS Close, but there is some errors with an unknown origin

parent c23f8ab8
......@@ -212,7 +212,13 @@ export class OperationViewComponent implements OnInit, OnDestroy {
public ngOnDestroy(): void {
this.subscriptions.forEach(s => {
s.unsubscribe();
try {
s.unsubscribe();
} catch (error) {
console.log(s);
console.error(error);
}
});
this.subscriptions = undefined;
this.updopews.destroy();
......
......@@ -148,7 +148,7 @@ export class OperationService implements OnDestroy{
public ngOnDestroy(): void {
this.subscriptions.forEach(s => {
s.unsubscribe();
// s.unsubscribe();
})
}
}
\ No newline at end of file
......@@ -62,9 +62,6 @@ export class SmsComponentComponent implements OnInit, OnDestroy {
(this.mapSrv.map as L.Map).addLayer(this.positions);
})
);
// this.subscriptions.push(
// this.mapSrv.mapZoomChanged.subscribe(this.updateLayerZoom.bind(this))
// );
}
ngOnInit(): void {
......@@ -118,7 +115,7 @@ export class SmsComponentComponent implements OnInit, OnDestroy {
public ngOnDestroy() : void {
this.subscriptions.forEach(s => {
s.unsubscribe();
s.unsubscribe();
});
this.wss.forEach(ws => {ws.destroy()});
......@@ -155,25 +152,4 @@ export class SmsComponentComponent implements OnInit, OnDestroy {
}
}).addTo(this.positions);
}
private updateLayerZoom() : void {
this.positions.clearLayers();
this.results.forEach(e => {
L.geoJSON(<any> e, {
pointToLayer: (feat, latLng) => {
let radius = feat.properties.accuracy;
radius = radius <= 15 ? 15 : radius;
radius *= this.oldzoom;
if ((this.mapSrv.map as L.Map).getZoom() > this.oldzoom){
radius /= 3;
}else{
radius *= 2;
}
this.oldzoom = (this.mapSrv.map as L.Map).getZoom()
return L.circle(latLng, radius, {color: "#ff0000", weight:5})
}
}).addTo(this.positions);
});
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment