File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
tensorboard/webapp/widgets/custom_modal Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import {
20
20
ElementRef ,
21
21
HostListener ,
22
22
OnInit ,
23
+ ViewContainerRef ,
23
24
} from '@angular/core' ;
24
25
import { BehaviorSubject } from 'rxjs' ;
25
26
@@ -40,7 +41,6 @@ export interface ModalContent {
40
41
`
41
42
:host {
42
43
position: fixed;
43
- top: -64px; /* The height of the top bar */
44
44
left: 0;
45
45
z-index: 9001;
46
46
}
@@ -62,6 +62,8 @@ export class CustomModalComponent implements OnInit {
62
62
63
63
private clickListener : ( ) => void = this . close . bind ( this ) ;
64
64
65
+ constructor ( private readonly viewRef : ViewContainerRef ) { }
66
+
65
67
ngOnInit ( ) {
66
68
this . visible$ . subscribe ( ( visible ) => {
67
69
// Wait until after the next browser frame.
@@ -76,6 +78,12 @@ export class CustomModalComponent implements OnInit {
76
78
}
77
79
78
80
public openAtPosition ( position : { x : number ; y : number } ) {
81
+ const root = this . viewRef . element . nativeElement ;
82
+ const top = root . getBoundingClientRect ( ) . top ;
83
+ if ( top !== 0 ) {
84
+ root . style . top = top * - 1 + root . offsetTop + 'px' ;
85
+ }
86
+
79
87
this . content . nativeElement . style . left = position . x + 'px' ;
80
88
this . content . nativeElement . style . top = position . y + 'px' ;
81
89
this . visible$ . next ( true ) ;
You can’t perform that action at this time.
0 commit comments