Commit 3abd1987 authored by Igor Kulikov's avatar Igor Kulikov

Fix

parent 103be44b
import { FcModelValidationService } from './modelvalidation.service'; import { FcModelValidationService } from './modelvalidation.service';
import { FcConnector, FcCoords, FcEdge, FcItemInfo, FcModel, FcNode, FcRectBox } from './ngx-flowchart.models'; import { FcConnector, FcCoords, FcEdge, FcItemInfo, FcModel, FcNode, FcRectBox } from './ngx-flowchart.models';
import { Observable, of } from 'rxjs'; import { Observable, of, Subject } from 'rxjs';
import { ChangeDetectorRef, EventEmitter } from '@angular/core'; import { ChangeDetectorRef, EventEmitter } from '@angular/core';
import { debounceTime } from 'rxjs/operators';
export class FcModelService { export class FcModelService {
...@@ -24,7 +25,8 @@ export class FcModelService { ...@@ -24,7 +25,8 @@ export class FcModelService {
dropTargetId: string; dropTargetId: string;
modelChanged: EventEmitter<any>; private readonly modelChanged: EventEmitter<any>;
private readonly debouncer = new Subject<any>();
connectors: ConnectorsModel; connectors: ConnectorsModel;
nodes: NodesModel; nodes: NodesModel;
...@@ -61,10 +63,14 @@ export class FcModelService { ...@@ -61,10 +63,14 @@ export class FcModelService {
this.connectors = new ConnectorsModel(this); this.connectors = new ConnectorsModel(this);
this.nodes = new NodesModel(this); this.nodes = new NodesModel(this);
this.edges = new EdgesModel(this); this.edges = new EdgesModel(this);
this.debouncer
.pipe(debounceTime(100))
.subscribe(() => this.modelChanged.emit());
} }
public notifyModelChanged() { public notifyModelChanged() {
this.modelChanged.emit(); this.debouncer.next();
} }
public detectChanges() { public detectChanges() {
......
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