Skip to content

Commit

Permalink
FLOE-437: improve implementation of now-playing highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
waharnum committed Jan 22, 2016
1 parent 398633d commit 8cb8d06
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions src/js/chartAuthoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,31 +229,32 @@ https://raw.githubusercontent.com/fluid-project/chartAuthoring/master/LICENSE.tx
var chartAuthoringInterface = that.chartAuthoringInterface;
var legendTable, tbody, rows;

if(currentlyPlayingData === null && chartAuthoringInterface !== undefined) {
// The chart authoring interface is ready
if(chartAuthoringInterface !== undefined) {
legendTable = chartAuthoringInterface.pieChart.legend.table;
tbody = legendTable.selectAll("tbody");
rows = tbody.selectAll("tr");
rows.classed("currently-playing",false);
}

if(currentlyPlayingData !== null) {
legendTable = chartAuthoringInterface.pieChart.legend.table;
tbody = legendTable.selectAll("tbody");
rows = tbody.selectAll("tr");
var activeRow = rows.filter(
function(d) {
return d.id === currentlyPlayingData.id;
}
);
// Nothing is currently playing; remove any highlighted rows
if(currentlyPlayingData === null) {
rows.classed("currently-playing",false);
}
if(currentlyPlayingData !== null) {
var activeRow = rows.filter(
function(d) {
return d.id === currentlyPlayingData.id;
}
);

var inactiveRows = rows.filter(
function(d) {
return d.id !== currentlyPlayingData.id;
}
);
var inactiveRows = rows.filter(
function(d) {
return d.id !== currentlyPlayingData.id;
}
);

activeRow.classed("currently-playing",true);
inactiveRows.classed("currently-playing",false);
activeRow.classed("currently-playing",true);
inactiveRows.classed("currently-playing",false);
}
}
};

Expand Down

0 comments on commit 8cb8d06

Please sign in to comment.