Solution ready for topology summary widget

This commit is contained in:
Piotr Pekala
2019-10-28 08:09:59 -07:00
parent cb71af1ea3
commit 3e8c21082b
2 changed files with 22 additions and 15 deletions

View File

@ -67,7 +67,7 @@ export class TopologySummaryComponent implements OnInit, OnDestroy {
this.computes = computes; this.computes = computes;
}); });
this.style = { top: '20px', right: '20px'}; this.style = { top: '20px', right: '20px', width: '300px', height: '400px'};
} }
toggleDragging(value: boolean) { toggleDragging(value: boolean) {
@ -78,21 +78,28 @@ export class TopologySummaryComponent implements OnInit, OnDestroy {
let x: number = Number(event.movementX); let x: number = Number(event.movementX);
let y: number = Number(event.movementY); let y: number = Number(event.movementY);
let left: number = Number(this.style['left'].split('px')[0]);
let top: number = Number(this.style['top'].split('px')[0]);
let width: number = Number(this.style['width'].split('px')[0]); let width: number = Number(this.style['width'].split('px')[0]);
let height: number = Number(this.style['height'].split('px')[0]); let height: number = Number(this.style['height'].split('px')[0]);
let top: number = Number(this.style['top'].split('px')[0]) + y;
top = top + y; if (this.style['left']) {
left = left + x; let left: number = Number(this.style['left'].split('px')[0]) + x;
this.style = {
this.style = { position: 'fixed',
position: 'fixed', left: `${left}px`,
left: `${left}px`, top: `${top}px`,
top: `${top}px`, width: `${width}px`,
width: `${width}px`, height: `${height}px`
height: `${height}px` };
}; } else {
let right: number = Number(this.style['right'].split('px')[0]) - x;
this.style = {
position: 'fixed',
right: `${right}px`,
top: `${top}px`,
width: `${width}px`,
height: `${height}px`
};
}
} }
validate(event: ResizeEvent): boolean { validate(event: ResizeEvent): boolean {