mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-02-23 10:40:16 +00:00
Merge pull request #1225 from GNS3/Remember-topology/servers-window-position
Update topology-summary.component.ts
This commit is contained in:
commit
7be137dc1c
@ -78,7 +78,28 @@ export class TopologySummaryComponent implements OnInit, OnDestroy {
|
|||||||
this.computes = computes;
|
this.computes = computes;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.revertPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
revertPosition(){
|
||||||
|
let leftPosition = localStorage.getItem('leftPosition');
|
||||||
|
let rightPosition = localStorage.getItem('rightPosition');
|
||||||
|
let topPosition = localStorage.getItem('topPosition');
|
||||||
|
let widthOfWidget = localStorage.getItem('widthOfWidget');
|
||||||
|
let heightOfWidget = localStorage.getItem('heightOfWidget');
|
||||||
|
|
||||||
|
if (!topPosition) {
|
||||||
this.style = { top: '60px', right: '0px', width: '320px', height: '400px' };
|
this.style = { top: '60px', right: '0px', width: '320px', height: '400px' };
|
||||||
|
} else {
|
||||||
|
this.style = {
|
||||||
|
position: 'fixed',
|
||||||
|
left: `${+leftPosition}px`,
|
||||||
|
right: `${+rightPosition}px`,
|
||||||
|
top: `${+topPosition}px`,
|
||||||
|
width: `${+widthOfWidget}px`,
|
||||||
|
height: `${+heightOfWidget}px`,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleDragging(value: boolean) {
|
toggleDragging(value: boolean) {
|
||||||
@ -101,6 +122,12 @@ export class TopologySummaryComponent implements OnInit, OnDestroy {
|
|||||||
width: `${width}px`,
|
width: `${width}px`,
|
||||||
height: `${height}px`,
|
height: `${height}px`,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
localStorage.setItem('leftPosition', left.toString());
|
||||||
|
localStorage.setItem('topPosition', top.toString());
|
||||||
|
localStorage.setItem('widthOfWidget', width.toString());
|
||||||
|
localStorage.setItem('heightOfWidget', height.toString());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
let right: number = Number(this.style['right'].split('px')[0]) - x;
|
let right: number = Number(this.style['right'].split('px')[0]) - x;
|
||||||
this.style = {
|
this.style = {
|
||||||
@ -110,6 +137,11 @@ export class TopologySummaryComponent implements OnInit, OnDestroy {
|
|||||||
width: `${width}px`,
|
width: `${width}px`,
|
||||||
height: `${height}px`,
|
height: `${height}px`,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
localStorage.setItem('rightPosition', right.toString());
|
||||||
|
localStorage.setItem('topPosition', top.toString());
|
||||||
|
localStorage.setItem('widthOfWidget', width.toString());
|
||||||
|
localStorage.setItem('heightOfWidget', height.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,6 +172,7 @@ export class TopologySummaryComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
toggleTopologyVisibility(value: boolean) {
|
toggleTopologyVisibility(value: boolean) {
|
||||||
this.isTopologyVisible = value;
|
this.isTopologyVisible = value;
|
||||||
|
this.revertPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
compareAsc(first: Node, second: Node) {
|
compareAsc(first: Node, second: Node) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user