mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
Merge pull request #1288 from Alfresco/dev-mvitale-1276
Dynamic diagram size
This commit is contained in:
commit
d50845cf4d
@ -0,0 +1,3 @@
|
||||
.diagram {
|
||||
border: 1px solid lightgray; overflow:auto
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<div *ngIf="diagram">
|
||||
<div *ngIf="diagram" class="diagram">
|
||||
<div *ngFor="let element of diagram.elements">
|
||||
<div [ngSwitch]="element.type">
|
||||
<div *ngSwitchCase="'StartEvent'">
|
||||
|
@ -25,6 +25,7 @@ import { DiagramModel, DiagramElementModel } from '../models/diagram.model';
|
||||
@Component({
|
||||
moduleId: module.id,
|
||||
selector: 'activiti-diagram',
|
||||
styleUrls: ['./diagram.component.css'],
|
||||
templateUrl: './diagram.component.html'
|
||||
})
|
||||
export class DiagramComponent {
|
||||
@ -52,6 +53,9 @@ export class DiagramComponent {
|
||||
@Output()
|
||||
onError = new EventEmitter();
|
||||
|
||||
PADDING_WIDTH: number = 60;
|
||||
PADDING_HEIGHT: number = 60;
|
||||
|
||||
private diagram: DiagramModel;
|
||||
private elementRef: ElementRef;
|
||||
|
||||
@ -66,10 +70,6 @@ export class DiagramComponent {
|
||||
this.elementRef = elementRef;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.raphaelService.setting(this.width, this.height);
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
this.reset();
|
||||
this.diagramColorService.setTotalColors(this.metricColor);
|
||||
@ -80,6 +80,7 @@ export class DiagramComponent {
|
||||
this.diagramsService.getProcessDefinitionModel(processDefinitionId).subscribe(
|
||||
(res: any) => {
|
||||
this.diagram = new DiagramModel(res);
|
||||
this.raphaelService.setting(this.diagram.diagramWidth + this.PADDING_WIDTH, this.diagram.diagramHeight + this.PADDING_HEIGHT);
|
||||
this.setMetricValueToDiagramElement(this.diagram, this.metricPercentages, this.metricType);
|
||||
this.onSuccess.emit(res);
|
||||
},
|
||||
|
@ -16,10 +16,10 @@
|
||||
*/
|
||||
|
||||
export class DiagramModel {
|
||||
diagramBeginX: string;
|
||||
diagramBeginY: string;
|
||||
diagramHeight: string;
|
||||
diagramWidth: string;
|
||||
diagramBeginX: number;
|
||||
diagramBeginY: number;
|
||||
diagramHeight: number;
|
||||
diagramWidth: number;
|
||||
elements: DiagramElementModel[] = [];
|
||||
flows: DiagramFlowElementModel[] = [];
|
||||
pools: DiagramPoolElementModel[] = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user