Added sync freezing while editing symbols
This commit is contained in:
parent
12c04c366d
commit
ae767f6a5d
@ -110,7 +110,7 @@ export class SyncService {
|
|||||||
}).snapshotChanges(), this.freeze)
|
}).snapshotChanges(), this.freeze)
|
||||||
.pipe(map(data => {
|
.pipe(map(data => {
|
||||||
let oldMap = this.mapData.value;
|
let oldMap = this.mapData.value;
|
||||||
if(data[2]) return oldMap;
|
if(data[2]) return;
|
||||||
let newMap = data[0] || {};
|
let newMap = data[0] || {};
|
||||||
let mergedMap = this.mergeMaps(newMap, oldMap);
|
let mergedMap = this.mergeMaps(newMap, oldMap);
|
||||||
|
|
||||||
@ -121,6 +121,7 @@ export class SyncService {
|
|||||||
|
|
||||||
return mergedMap;
|
return mergedMap;
|
||||||
})).subscribe((mapData: MapData) => {
|
})).subscribe((mapData: MapData) => {
|
||||||
|
if(!mapData) return;
|
||||||
this.mapData.next(mapData);
|
this.mapData.next(mapData);
|
||||||
this.status.next(null);
|
this.status.next(null);
|
||||||
if(this.saveInterval) clearInterval(this.saveInterval);
|
if(this.saveInterval) clearInterval(this.saveInterval);
|
||||||
|
@ -110,7 +110,9 @@ export class MapComponent implements OnDestroy, OnInit {
|
|||||||
this.map.click.pipe(filter(e => !!e)).subscribe(e => {
|
this.map.click.pipe(filter(e => !!e)).subscribe(e => {
|
||||||
if(this.sub == null && e.symbol) {
|
if(this.sub == null && e.symbol) {
|
||||||
if(e.symbol.noClick) return;
|
if(e.symbol.noClick) return;
|
||||||
|
this.syncService.freeze.next(true);
|
||||||
this.sub = this.bottomSheet.open(EditSymbolComponent, {data: e, disableClose: true, hasBackdrop: false}).afterDismissed().pipe(finalize(() => this.sub = null)).subscribe(symbol => {
|
this.sub = this.bottomSheet.open(EditSymbolComponent, {data: e, disableClose: true, hasBackdrop: false}).afterDismissed().pipe(finalize(() => this.sub = null)).subscribe(symbol => {
|
||||||
|
this.syncService.freeze.next(false);
|
||||||
this.syncService.delete(e.symbol);
|
this.syncService.delete(e.symbol);
|
||||||
if(e.item instanceof L.Circle) {
|
if(e.item instanceof L.Circle) {
|
||||||
this.syncService.addCircle(symbol);
|
this.syncService.addCircle(symbol);
|
||||||
|
Loading…
Reference in New Issue
Block a user