Skip to content

Commit

Permalink
Bug fix: Live Ensemble Distance Map (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
turner authored Oct 17, 2024
1 parent 2569cec commit c16b364
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions js/juicebox/liveDistanceMapService.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,27 @@ class LiveDistanceMapService {
configureMouseHandlers(){

this.ensembleToggleElement = juiceboxPanel.panel.querySelector('#spacewalk-live-distance-map-toggle-ensemble')

this.ensembleToggleElement.addEventListener('click', () => {
this.updateEnsembleAverageDistanceCanvas(ensembleManager.getLiveMapTraceLength(), ensembleManager.getLiveMapVertexLists())
const liveMapTraceLength = ensembleManager.getLiveMapTraceLength()
const liveMapVertexLists = ensembleManager.getLiveMapVertexLists()
this.updateEnsembleAverageDistanceCanvas(liveMapTraceLength)
})

this.traceToggleElement = juiceboxPanel.panel.querySelector('#spacewalk-live-distance-map-toggle-trace')
this.traceToggleElement.addEventListener('click', () => {
this.updateTraceDistanceCanvas(ensembleManager.getLiveMapTraceLength(), ensembleManager.currentTrace)
const liveMapTraceLength = ensembleManager.getLiveMapTraceLength()
this.updateTraceDistanceCanvas(liveMapTraceLength, ensembleManager.currentTrace)
})

juiceboxPanel.panel.querySelector('#hic-calculation-live-distance-button').addEventListener('click', event => {
if (this.isEnsembleToggleChecked()) {
this.updateEnsembleAverageDistanceCanvas(ensembleManager.getLiveMapTraceLength(), ensembleManager.getLiveMapVertexLists())
const liveMapTraceLength = ensembleManager.getLiveMapTraceLength()
const liveMapVertexLists = ensembleManager.getLiveMapVertexLists()
this.updateEnsembleAverageDistanceCanvas(liveMapTraceLength)
} else if (this.isTraceToggleChecked()) {
this.updateTraceDistanceCanvas(ensembleManager.getLiveMapTraceLength(), ensembleManager.currentTrace)
const liveMapTraceLength = ensembleManager.getLiveMapTraceLength()
this.updateTraceDistanceCanvas(liveMapTraceLength, ensembleManager.currentTrace)
}
})

Expand Down Expand Up @@ -114,14 +121,16 @@ class LiveDistanceMapService {

}

async updateEnsembleAverageDistanceCanvas(traceLength, vertexLists) {
async updateEnsembleAverageDistanceCanvas(traceLength) {

const status = await enableLiveMaps()

if (true === status) {

showGlobalSpinner()

const vertexLists = ensembleManager.getLiveMapVertexLists()

const data =
{
traceOrEnsemble: 'ensemble',
Expand Down

0 comments on commit c16b364

Please sign in to comment.