Permalink
Browse files

[0.10.4] repaint endpoint

  • Loading branch information...
dog-ears committed Feb 22, 2018
1 parent 4123bec commit 311d734be13d37ce306d7cca63573e32e305ceab
@@ -26,4 +26,12 @@ export class AppComponent {
console.log('AppComponent.ngAfterViewInit() is called!');
this.jsPlumbService.init();
}
ngAfterViewChecked(){
//console.log('AppComponent.ngAfterViewChecked() is called!');
if(this.dataService.flg_repaint){
this.dataService.flg_repaint = false;
this.jsPlumbService.repaintEverything();
}
}
}
@@ -22,6 +22,11 @@ export class ModalModelComponent {
constructor( private bsModalRef: BsModalRef, private dataService: DataService ) {}
ngOnDestroy() {
console.log('ModalSchemaComponent.ngOnDestroy() is called!');
this.dataService.flg_repaint = true;
}
private create(){
console.log('ModalTableComponent.create() is called!');
this.dataService.addModel(this.model);
@@ -20,6 +20,11 @@ export class ModalSchemaComponent {
constructor( private bsModalRef: BsModalRef, private dataService: DataService ) {}
ngOnDestroy() {
console.log('ModalSchemaComponent.ngOnDestroy() is called!');
this.dataService.flg_repaint = true;
}
private create(){
console.log('ModalSchemaComponent.create() is called!');
this.dataService.addSchema(this.schema);
@@ -10,10 +10,12 @@ import { Schema } from '../class/schema';
export class DataService {
public data:Data;
public flg_repaint:boolean;
constructor() {
console.log('DataService.constructor() is called!');
this.data = new Data();
this.flg_repaint = false;
}
public addModel(model: Model):void{
@@ -25,6 +27,7 @@ export class DataService {
public deleteModel(id: number):void{
console.log('DataService.deleteModel() is called!');
this.data.models = this.data.models.filter((v,i)=>v.id!=id);
this.flg_repaint = true;
}
public addSchema(schema:Schema):void{
@@ -38,6 +41,7 @@ export class DataService {
console.log('DataService.deleteSchema() is called!');
var obj_model = this.data.getModelById(schema.parent_id);
obj_model.schemas = obj_model.schemas.filter((v,i)=>v.id!=schema.id);
this.flg_repaint = true;
}
public moveSchema(schema:Schema, dir:number):void{
@@ -55,5 +59,6 @@ export class DataService {
}
}
this.flg_repaint = true;
}
}
@@ -49,4 +49,10 @@ export class JsPlumbService {
console.log('JsPlumbService.toggleDraggable() is called!');
this._instance.toggleDraggable( model.getElementId() );
}
public repaintEverything(): void{
console.log('JsPlumbService.repaintEverything() is called!');
this._instance.repaintEverything();
}
}

0 comments on commit 311d734

Please sign in to comment.