Skip to content

Commit

Permalink
Discard Popovers whenever column count is altered. Prevents zombie Po…
Browse files Browse the repository at this point in the history
…pover objects.
  • Loading branch information
turner committed Dec 18, 2023
1 parent 3019436 commit b3ccc66
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class Browser {
}
})

this.on('willremovecolumn', column => {
this.on('didchangecolumnlayout', () => {
if (trackViewportPopoverList.length > 0) {
const len = trackViewportPopoverList.length
for (let i = 0; i < len; i++) {
Expand Down Expand Up @@ -1547,6 +1547,7 @@ class Browser {
// TODO -- this is really ugly
const {$viewport} = this.trackViews[0].viewports[indexLeft]
const viewportColumn = viewportColumnManager.insertAfter($viewport.get(0).parentElement)
this.fireEvent('didchangecolumnlayout')

if (indexRight === this.referenceFrameList.length) {
this.referenceFrameList.push(newReferenceFrame)
Expand Down Expand Up @@ -1591,9 +1592,8 @@ class Browser {
const index = this.referenceFrameList.indexOf(referenceFrame)
const {$viewport} = this.trackViews[0].viewports[index]

this.fireEvent('willremovecolumn', [ $viewport.parent().get(0) ]);

viewportColumnManager.removeColumnAtIndex(index, $viewport.parent().get(0))
this.fireEvent('didchangecolumnlayout')

for (let {viewports} of this.trackViews) {
viewports[index].dispose()
Expand Down Expand Up @@ -1732,6 +1732,7 @@ class Browser {

// Insert viewport columns preceding the sample info column
viewportColumnManager.insertBefore(this.columnContainer.querySelector('.igv-sample-info-column'), this.referenceFrameList.length)
this.fireEvent('didchangecolumnlayout')

this.centerLineList = this.createCenterLineList(this.columnContainer)

Expand Down

0 comments on commit b3ccc66

Please sign in to comment.