mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
Refactoring options
This commit is contained in:
+2
-2
@@ -1,2 +1,2 @@
|
|||||||
<raphael-circle [center]="center" [radius]="data.radius" [strokeWidth]="data.strokeWidth" [stroke]="data.stroke"
|
<raphael-circle [center]="center" [radius]="options.radius" [strokeWidth]="options.strokeWidth" [stroke]="options.stroke"
|
||||||
[fillColors]="data.fillColors" [fillOpacity]="data.fillOpacity"></raphael-circle>
|
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-circle>
|
||||||
+6
-5
@@ -38,6 +38,7 @@ export class DiagramEventComponent {
|
|||||||
onError = new EventEmitter();
|
onError = new EventEmitter();
|
||||||
|
|
||||||
center: any = {};
|
center: any = {};
|
||||||
|
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: '', radius: ''};
|
||||||
|
|
||||||
constructor(public elementRef: ElementRef,
|
constructor(public elementRef: ElementRef,
|
||||||
private diagramColorService: DiagramColorService) {}
|
private diagramColorService: DiagramColorService) {}
|
||||||
@@ -47,10 +48,10 @@ export class DiagramEventComponent {
|
|||||||
this.center.x = this.data.x + (this.data.width / 2);
|
this.center.x = this.data.x + (this.data.width / 2);
|
||||||
this.center.y = this.data.y + (this.data.height / 2);
|
this.center.y = this.data.y + (this.data.height / 2);
|
||||||
|
|
||||||
this.data.radius = this.radius;
|
this.options.radius = this.radius;
|
||||||
this.data.strokeWidth = this.strokeWidth;
|
this.options.strokeWidth = this.strokeWidth;
|
||||||
this.data.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.MAIN_STROKE_COLOR);
|
this.options.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.MAIN_STROKE_COLOR);
|
||||||
this.data.fillColors = this.diagramColorService.getFillColour(this.data.id);
|
this.options.fillColors = this.diagramColorService.getFillColour(this.data.id);
|
||||||
this.data.fillOpacity = this.diagramColorService.getFillOpacity();
|
this.options.fillOpacity = this.diagramColorService.getFillOpacity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -1,3 +1,4 @@
|
|||||||
<raphael-rect [leftCorner]="rectLeftCorner" [width]="data.width" [height]="data.height" [radius]="radius" [stroke]="data.stroke" [strokeWidth]="data.strokeWidth"
|
<raphael-rect [leftCorner]="rectLeftCorner" [width]="data.width" [height]="data.height" [radius]="options.radius"
|
||||||
[fillColors]="data.fillColors" [fillOpacity]="data.fillOpacity"></raphael-rect>
|
[stroke]="options.stroke" [strokeWidth]="options.strokeWidth"
|
||||||
|
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-rect>
|
||||||
<raphael-text [text]="data.name" [position]="textPosition"></raphael-text>
|
<raphael-text [text]="data.name" [position]="textPosition"></raphael-text>
|
||||||
+5
-15
@@ -28,33 +28,23 @@ export class DiagramTaskComponent {
|
|||||||
@Input()
|
@Input()
|
||||||
data: any;
|
data: any;
|
||||||
|
|
||||||
options: any = {};
|
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
onError = new EventEmitter();
|
onError = new EventEmitter();
|
||||||
|
|
||||||
stroke: number;
|
|
||||||
|
|
||||||
rectLeftCorner: any;
|
rectLeftCorner: any;
|
||||||
radius: number = 4;
|
|
||||||
|
|
||||||
textPosition: any;
|
textPosition: any;
|
||||||
|
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: '', radius: 4};
|
||||||
|
|
||||||
constructor(public elementRef: ElementRef,
|
constructor(public elementRef: ElementRef,
|
||||||
private diagramColorService: DiagramColorService) {}
|
private diagramColorService: DiagramColorService) {}
|
||||||
|
|
||||||
ngOnInit() {
|
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.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.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'">
|
<div *ngSwitchCase="'ExclusiveGateway'">
|
||||||
<diagram-exclusive-gateway [data]="element"></diagram-exclusive-gateway>
|
<diagram-exclusive-gateway [data]="element"></diagram-exclusive-gateway>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngSwitchCase="'ParallelGateway'">
|
||||||
|
<diagram-parallel-gateway [data]="element"></diagram-parallel-gateway>
|
||||||
|
</div>
|
||||||
<div *ngSwitchCase="'EndEvent'">
|
<div *ngSwitchCase="'EndEvent'">
|
||||||
<diagram-event [data]="element" [radius]="14" [strokeWidth]="4"></diagram-event>
|
<diagram-event [data]="element" [radius]="14" [strokeWidth]="4"></diagram-event>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
<diagram-gateway [data]="data"></diagram-gateway>
|
<diagram-gateway [data]="data"></diagram-gateway>
|
||||||
<raphael-cross [center]="center" [width]="data.width" [height]="data.height" [stroke]="data.stroke" [strokeWidth]="data.strokeWidth"
|
<raphael-cross [center]="center" [width]="width" [height]="height" [stroke]="options.stroke" [strokeWidth]="options.strokeWidth"
|
||||||
[fillColors]="data.fillColors" [fillOpacity]="data.fillOpacity"></raphael-cross>
|
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-cross>
|
||||||
+8
-4
@@ -32,6 +32,9 @@ export class DiagramExclusiveGatewayComponent {
|
|||||||
onError = new EventEmitter();
|
onError = new EventEmitter();
|
||||||
|
|
||||||
center: any = {};
|
center: any = {};
|
||||||
|
width: any;
|
||||||
|
height: any;
|
||||||
|
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: 3};
|
||||||
|
|
||||||
constructor(public elementRef: ElementRef,
|
constructor(public elementRef: ElementRef,
|
||||||
private diagramColorService: DiagramColorService) {}
|
private diagramColorService: DiagramColorService) {}
|
||||||
@@ -39,10 +42,11 @@ export class DiagramExclusiveGatewayComponent {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.center.x = this.data.x;
|
this.center.x = this.data.x;
|
||||||
this.center.y = this.data.y;
|
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.options.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.MAIN_STROKE_COLOR);
|
||||||
this.data.fillColors = this.diagramColorService.getFillColour(this.data.id);
|
this.options.fillColors = this.diagramColorService.getFillColour(this.data.id);
|
||||||
this.data.fillOpacity = this.diagramColorService.getFillOpacity();
|
this.options.fillOpacity = this.diagramColorService.getFillOpacity();
|
||||||
this.data.strokeWidth = 3;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,2 +1,2 @@
|
|||||||
<raphael-rhombus [center]="center" [width]="data.width" [height]="data.height" [stroke]="data.stroke" [strokeWidth]="2"
|
<raphael-rhombus [center]="center" [width]="width" [height]="height" [stroke]="options.stroke" [strokeWidth]="options.strokeWidth"
|
||||||
[fillColors]="data.fillColors" [fillOpacity]="data.fillOpacity"></raphael-rhombus>
|
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-rhombus>
|
||||||
+8
-4
@@ -32,6 +32,9 @@ export class DiagramGatewayComponent {
|
|||||||
onError = new EventEmitter();
|
onError = new EventEmitter();
|
||||||
|
|
||||||
center: any = {};
|
center: any = {};
|
||||||
|
width: any;
|
||||||
|
height: any;
|
||||||
|
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: 2};
|
||||||
|
|
||||||
constructor(public elementRef: ElementRef,
|
constructor(public elementRef: ElementRef,
|
||||||
private diagramColorService: DiagramColorService) {}
|
private diagramColorService: DiagramColorService) {}
|
||||||
@@ -39,10 +42,11 @@ export class DiagramGatewayComponent {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.center.x = this.data.x;
|
this.center.x = this.data.x;
|
||||||
this.center.y = this.data.y;
|
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.options.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.MAIN_STROKE_COLOR);
|
||||||
this.data.fillColors = this.diagramColorService.getFillColour(this.data.id);
|
this.options.fillColors = this.diagramColorService.getFillColour(this.data.id);
|
||||||
this.data.fillOpacity = this.diagramColorService.getFillOpacity();
|
this.options.fillOpacity = this.diagramColorService.getFillOpacity();
|
||||||
this.data.strokeWidth = 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user