Refactoring options

This commit is contained in:
mauriziovitale84
2016-10-31 10:29:33 +00:00
parent 4b2d5ecee4
commit da173d9d1e
9 changed files with 39 additions and 36 deletions
@@ -1,2 +1,2 @@
<raphael-circle [center]="center" [radius]="data.radius" [strokeWidth]="data.strokeWidth" [stroke]="data.stroke"
[fillColors]="data.fillColors" [fillOpacity]="data.fillOpacity"></raphael-circle>
<raphael-circle [center]="center" [radius]="options.radius" [strokeWidth]="options.strokeWidth" [stroke]="options.stroke"
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-circle>
@@ -38,6 +38,7 @@ export class DiagramEventComponent {
onError = new EventEmitter();
center: any = {};
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: '', radius: ''};
constructor(public elementRef: ElementRef,
private diagramColorService: DiagramColorService) {}
@@ -47,10 +48,10 @@ export class DiagramEventComponent {
this.center.x = this.data.x + (this.data.width / 2);
this.center.y = this.data.y + (this.data.height / 2);
this.data.radius = this.radius;
this.data.strokeWidth = this.strokeWidth;
this.data.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.MAIN_STROKE_COLOR);
this.data.fillColors = this.diagramColorService.getFillColour(this.data.id);
this.data.fillOpacity = this.diagramColorService.getFillOpacity();
this.options.radius = this.radius;
this.options.strokeWidth = this.strokeWidth;
this.options.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.MAIN_STROKE_COLOR);
this.options.fillColors = this.diagramColorService.getFillColour(this.data.id);
this.options.fillOpacity = this.diagramColorService.getFillOpacity();
}
}
@@ -1,3 +1,4 @@
<raphael-rect [leftCorner]="rectLeftCorner" [width]="data.width" [height]="data.height" [radius]="radius" [stroke]="data.stroke" [strokeWidth]="data.strokeWidth"
[fillColors]="data.fillColors" [fillOpacity]="data.fillOpacity"></raphael-rect>
<raphael-rect [leftCorner]="rectLeftCorner" [width]="data.width" [height]="data.height" [radius]="options.radius"
[stroke]="options.stroke" [strokeWidth]="options.strokeWidth"
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-rect>
<raphael-text [text]="data.name" [position]="textPosition"></raphael-text>
@@ -28,33 +28,23 @@ export class DiagramTaskComponent {
@Input()
data: any;
options: any = {};
@Output()
onError = new EventEmitter();
stroke: number;
rectLeftCorner: any;
radius: number = 4;
textPosition: any;
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: '', radius: 4};
constructor(public elementRef: ElementRef,
private diagramColorService: DiagramColorService) {}
ngOnInit() {
console.log(this.elementRef);
this.data.fillColors = this.diagramColorService.getFillColour(this.data.id);
this.data.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.ACTIVITY_STROKE_COLOR);
this.data.strokeWidth = this.diagramColorService.getBpmnStrokeWidth(this.data);
this.data.fillOpacity = this.diagramColorService.getFillOpacity();
this.rectLeftCorner = {x: this.data.x, y: this.data.y};
this.textPosition = {x: this.data.x + ( this.data.width / 2 ), y: this.data.y + ( this.data.height / 2 )};
this.options['id'] = this.data.id;
this.options.fillColors = this.diagramColorService.getFillColour(this.data.id);
this.options.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.ACTIVITY_STROKE_COLOR);
this.options.strokeWidth = this.diagramColorService.getBpmnStrokeWidth(this.data);
this.options.fillOpacity = this.diagramColorService.getFillOpacity();
}
}
@@ -7,6 +7,9 @@
<div *ngSwitchCase="'ExclusiveGateway'">
<diagram-exclusive-gateway [data]="element"></diagram-exclusive-gateway>
</div>
<div *ngSwitchCase="'ParallelGateway'">
<diagram-parallel-gateway [data]="element"></diagram-parallel-gateway>
</div>
<div *ngSwitchCase="'EndEvent'">
<diagram-event [data]="element" [radius]="14" [strokeWidth]="4"></diagram-event>
</div>
@@ -1,3 +1,3 @@
<diagram-gateway [data]="data"></diagram-gateway>
<raphael-cross [center]="center" [width]="data.width" [height]="data.height" [stroke]="data.stroke" [strokeWidth]="data.strokeWidth"
[fillColors]="data.fillColors" [fillOpacity]="data.fillOpacity"></raphael-cross>
<raphael-cross [center]="center" [width]="width" [height]="height" [stroke]="options.stroke" [strokeWidth]="options.strokeWidth"
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-cross>
@@ -32,6 +32,9 @@ export class DiagramExclusiveGatewayComponent {
onError = new EventEmitter();
center: any = {};
width: any;
height: any;
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: 3};
constructor(public elementRef: ElementRef,
private diagramColorService: DiagramColorService) {}
@@ -39,10 +42,11 @@ export class DiagramExclusiveGatewayComponent {
ngOnInit() {
this.center.x = this.data.x;
this.center.y = this.data.y;
this.width = this.data.width;
this.height = this.data.height;
this.data.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.MAIN_STROKE_COLOR);
this.data.fillColors = this.diagramColorService.getFillColour(this.data.id);
this.data.fillOpacity = this.diagramColorService.getFillOpacity();
this.data.strokeWidth = 3;
this.options.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.MAIN_STROKE_COLOR);
this.options.fillColors = this.diagramColorService.getFillColour(this.data.id);
this.options.fillOpacity = this.diagramColorService.getFillOpacity();
}
}
@@ -1,2 +1,2 @@
<raphael-rhombus [center]="center" [width]="data.width" [height]="data.height" [stroke]="data.stroke" [strokeWidth]="2"
[fillColors]="data.fillColors" [fillOpacity]="data.fillOpacity"></raphael-rhombus>
<raphael-rhombus [center]="center" [width]="width" [height]="height" [stroke]="options.stroke" [strokeWidth]="options.strokeWidth"
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-rhombus>
@@ -32,6 +32,9 @@ export class DiagramGatewayComponent {
onError = new EventEmitter();
center: any = {};
width: any;
height: any;
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: 2};
constructor(public elementRef: ElementRef,
private diagramColorService: DiagramColorService) {}
@@ -39,10 +42,11 @@ export class DiagramGatewayComponent {
ngOnInit() {
this.center.x = this.data.x;
this.center.y = this.data.y;
this.width = this.data.width;
this.height = this.data.height;
this.data.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.MAIN_STROKE_COLOR);
this.data.fillColors = this.diagramColorService.getFillColour(this.data.id);
this.data.fillOpacity = this.diagramColorService.getFillOpacity();
this.data.strokeWidth = 2;
this.options.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.MAIN_STROKE_COLOR);
this.options.fillColors = this.diagramColorService.getFillColour(this.data.id);
this.options.fillOpacity = this.diagramColorService.getFillOpacity();
}
}