@@ -37,7 +37,7 @@ class TrackViewport extends Viewport {
37
37
38
38
const track = this . trackView . track ;
39
39
if ( 'sequence' !== track . type ) {
40
- this . zoomInNoticeElement = this . createZoomInNotice ( this . viewportElement ) ;
40
+ this . zoomInNoticeElement = TrackViewport . createZoomInNotice ( this . viewportElement ) ;
41
41
}
42
42
43
43
if ( "sequence" !== track . id ) {
@@ -74,7 +74,9 @@ class TrackViewport extends Viewport {
74
74
}
75
75
76
76
startSpinner ( ) {
77
- this . spinnerElement . style . display = 'block' ;
77
+ if ( this . spinnerElement ) {
78
+ this . spinnerElement . style . display = 'flex' ;
79
+ }
78
80
}
79
81
80
82
stopSpinner ( ) {
@@ -129,7 +131,7 @@ class TrackViewport extends Viewport {
129
131
this . setContentHeight ( minHeight )
130
132
}
131
133
if ( this . zoomInNoticeElement ) {
132
- this . zoomInNoticeElement . style . display = 'block ' ;
134
+ this . zoomInNoticeElement . style . display = 'flex ' ;
133
135
}
134
136
return false
135
137
} else {
@@ -240,7 +242,7 @@ class TrackViewport extends Viewport {
240
242
}
241
243
this . loading = { start : bpStart , end : bpEnd }
242
244
this . startSpinner ( )
243
-
245
+
244
246
const track = this . trackView . track
245
247
const features = await this . getFeatures ( track , chr , bpStart , bpEnd , referenceFrame . bpPerPixel )
246
248
if ( features ) {
@@ -421,13 +423,14 @@ class TrackViewport extends Viewport {
421
423
422
424
if ( ! this . canvas ) return
423
425
426
+ const w = this . viewportElement . clientWidth * window . devicePixelRatio ;
427
+ const h = this . viewportElement . clientHeight * window . devicePixelRatio ;
428
+
429
+ const x = - this . canvas . offsetLeft * window . devicePixelRatio
430
+
424
431
const canvasMetadata = this . canvas . _data
425
432
const canvasTop = canvasMetadata ? canvasMetadata . pixelTop : 0
426
- const devicePixelRatio = window . devicePixelRatio
427
- const w = this . viewportElement . clientWidth * devicePixelRatio ;
428
- const h = this . viewportElement . clientHeight * devicePixelRatio ;
429
- const x = - this . canvas . getBoundingClientRect ( ) . left * devicePixelRatio ;
430
- const y = ( - this . contentTop - canvasTop ) * devicePixelRatio ;
433
+ const y = ( - this . contentTop - canvasTop ) * window . devicePixelRatio ;
431
434
432
435
const ctx = this . canvas . getContext ( "2d" )
433
436
const imageData = ctx . getImageData ( x , y , w , h )
@@ -494,7 +497,7 @@ class TrackViewport extends Viewport {
494
497
495
498
renderSVGContext ( context , { deltaX, deltaY} , includeLabel = true ) {
496
499
497
- const zoomInNotice = this . zoomInNoticeElement && this . zoomInNoticeElement . is ( ":visible" )
500
+ const zoomInNotice = this . zoomInNoticeElement && this . zoomInNoticeElement . style . display !== 'flex'
498
501
499
502
if ( ! zoomInNotice ) {
500
503
@@ -617,20 +620,19 @@ class TrackViewport extends Viewport {
617
620
return ( ! this . featureCache . containsRange ( chr , bpStart , bpEnd , bpPerPixel , this . windowFunction ) )
618
621
}
619
622
620
- createZoomInNotice ( parentElement ) {
623
+ static createZoomInNotice ( parentElement ) {
621
624
622
- const element = document . createElement ( 'div' ) ;
623
- element . className = 'igv-zoom-in-notice-container' ;
624
- parentElement . appendChild ( element ) ;
625
-
626
- const $e = document . createElement ( 'div' ) ;
627
- element . appendChild ( $e ) ;
625
+ const container = document . createElement ( 'div' ) ;
626
+ container . className = 'igv-zoom-in-notice-container' ;
627
+ parentElement . appendChild ( container ) ;
628
628
629
- $e . textContent = 'Zoom in to see features' ;
629
+ const element = document . createElement ( 'div' ) ;
630
+ container . appendChild ( element ) ;
631
+ element . textContent = 'Zoom in to see features' ;
630
632
631
- element . style . display = 'none' ;
633
+ container . style . display = 'none' ;
632
634
633
- return element ;
635
+ return container ;
634
636
}
635
637
636
638
viewIsReady ( ) {
0 commit comments