Skip to content

Commit

Permalink
Avoid tracking of selection columns, but track score columns
Browse files Browse the repository at this point in the history
Caleydo/targid2#288
  • Loading branch information
Holger Stitz committed Oct 14, 2016
1 parent ae33120 commit e569efd
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions LineUpView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,17 +342,21 @@ export abstract class ALineUpView2 extends AView {
diffAdded.forEach((id) => {
this.getSelectionColumnDesc(id)
.then((columnDesc) => {
this.addColumn(columnDesc, this.loadSelectionColumnData.bind(this), id);
this.withoutTracking(() => {
this.addColumn(columnDesc, this.loadSelectionColumnData.bind(this), id, true); // true == withoutTracking
});
});
});
}

// remove deselected columns
if(diffRemoved.length > 0) {
//console.log('remove columns', diffRemoved);
diffRemoved.forEach((id) => {
let col = usedCols.filter((d) => d.desc.selectedId === id)[0];
ranking.remove(col);
this.withoutTracking(() => {
//console.log('remove columns', diffRemoved);
diffRemoved.forEach((id) => {
let col = usedCols.filter((d) => d.desc.selectedId === id)[0];
ranking.remove(col);
});
});
}
}
Expand All @@ -377,7 +381,7 @@ export abstract class ALineUpView2 extends AView {
});
}

protected addColumn(colDesc, loadColumnData: (id) => Promise<IScoreRow<any>[]>, id = -1) {
protected addColumn(colDesc, loadColumnData: (id) => Promise<IScoreRow<any>[]>, id = -1, withoutTracking = false) {
const ranking = this.lineup.data.getLastRanking();
const colors = this.getAvailableColumnColors(ranking);

Expand Down Expand Up @@ -422,7 +426,15 @@ export abstract class ALineUpView2 extends AView {
if (!(colDesc.constantDomain)) { //create a dynamic range if not fixed
colDesc.domain = d3.extent(<number[]>(d3.values(scores)));
}
col.setMapping(new lineup.model.ScaleMappingFunction(colDesc.domain));
// add selection columns wihtout tracking changes
if(withoutTracking) {
this.withoutTracking(() => {
col.setMapping(new lineup.model.ScaleMappingFunction(colDesc.domain));
});
// however, track changes in score columns
} else {
col.setMapping(new lineup.model.ScaleMappingFunction(colDesc.domain));
}
}
this.lineup.update();
});
Expand Down

0 comments on commit e569efd

Please sign in to comment.