Skip to content

Commit 1c019bb

Browse files
committed
Better GenericContainer presentation positioning
1 parent 7bab4c3 commit 1c019bb

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

css/_igv-generic-container.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
.igv-generic-container {
33

44
position: absolute;
5-
top: 0;
6-
left:0;
5+
6+
top: 50%;
7+
left: 50%;
8+
transform: translate(-50%, -50%);
79

810
z-index: 2048;
911

css/igv.css

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/ui/genericContainer.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,11 @@ class GenericContainer {
77

88
constructor({parent, top, left, width, height, border, closeHandler}) {
99

10-
let container = DOMUtils.div({class: 'igv-ui-generic-container'});
10+
const container = DOMUtils.div({class: 'igv-ui-generic-container'});
1111
parent.appendChild(container);
12-
DOMUtils.hide(container);
12+
1313
this.container = container;
1414

15-
if(top !== undefined) {
16-
this.container.style.top = `${ top }px`
17-
}
18-
if(left !== undefined) {
19-
this.container.style.left = `${ left }px`
20-
}
2115
if (width !== undefined) {
2216
this.container.style.width = `${ width }px`
2317
}
@@ -27,32 +21,30 @@ class GenericContainer {
2721
if(border) {
2822
this.container.style.border = border;
2923
}
30-
//
31-
// let bbox = parent.getBoundingClientRect();
32-
// this.origin = {x: bbox.x, y: bbox.y};
33-
// this.container.offset({left: this.origin.x, top: this.origin.y});
3424

3525
// header
3626
const header = DOMUtils.div();
3727
this.container.appendChild(header);
3828

3929
// close button
4030
UIUtils.attachDialogCloseHandlerWithParent(header, (e) => {
41-
DOMUtils.hide(this.container);
4231
if(typeof closeHandler === "function") {
4332
closeHandler(e);
4433
}
34+
this.hide()
4535
});
4636

4737
makeDraggable(this.container, header);
38+
39+
this.hide()
4840
}
4941

5042
show() {
51-
DOMUtils.show(this.container);
43+
this.container.style.display = 'flex'
5244
}
5345

5446
hide() {
55-
DOMUtils.hide(this.container)
47+
this.container.style.display = 'none'
5648
}
5749

5850
dispose() {

0 commit comments

Comments
 (0)