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

@ -3,7 +3,7 @@
(document:mousemove)="dragWidget($event)"
(document:mouseup)="toggleDragging(false)">
</div>
<div
<div
class="summaryWrapper"
(mousedown)="toggleDragging(true)"
*ngIf="projectsStatistics"

View File

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