Skip to content

Commit

Permalink
More progress on integrating controls - up to runtime debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed Nov 23, 2015
1 parent 29320b4 commit 7abdfe2
Show file tree
Hide file tree
Showing 6 changed files with 361 additions and 836 deletions.
14 changes: 7 additions & 7 deletions src/app/d3Bindings/eventDistribution/distributionCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ angular
successfulImages = new Set();

return {
focusStemPathDefaults: {
width: 91,
stems: 4,
root: 8
},
getFocusStemPath(width) {
const focusStemPath = {
width: 91,
stems: 4,
root: 8
};

let w = Math.round(width || focusStemPath.width) + focusStemPath.stems,
let focusStemPath = this.focusStemPathDefaults,
w = Math.round(width || focusStemPath.width) + focusStemPath.stems,
hw = w / 2.0,
s = focusStemPath.stems,
r = focusStemPath.root;
Expand Down
31 changes: 20 additions & 11 deletions src/app/d3Bindings/eventDistribution/distributionDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ angular
if (visualizationBrushArea) {
visualizationBrushArea.attr("height", dims.height);
}
if (visualizationBrushLaneOverlay) {
visualizationBrushLaneOverlay.attr("height", getFocusedLaneHeight());
}
if (outOfBoundsRect) {
outOfBoundsRect.attr(dims);
}
Expand Down Expand Up @@ -375,18 +378,15 @@ angular

function updateScales() {
// if there is no visible extent set, zoom out to full data set
self.visibleExtent = self.visibleExtent || [self.minimum, self.maximum];
// warning this resets the zoom level
// though it should only take effect when visible extent === 0
if (!self.visibleExtent || +self.visibleExtent[1] - +self.visibleExtent[0] === 0) {
self.visibleExtent = [self.minimum, self.maximum];
}

let min = +self.minimum || 0,
max = +self.maximum || 0,
delta = max - min,
visibleFraction = delta / self.currentZoomValue;
// finally, convert to seconds

self.visibleDuration = (+self.visibleExtent[1] - +self.visibleExtent[0]) / common.msInS;
console.assert(
visibleFraction / common.msInS === self.visibleExtent[1] - self.visibleExtent[0],
"My math should be correct!");


// TODO: snap tile domain to zoom levels that are available
self.tileSizeSeconds = self.visibleDuration / tileCount;
Expand All @@ -407,6 +407,15 @@ angular
// falsely trigger zoom events to force d3 to re-render with new scale
zoomUpdate();

// by this point the two methods for calculating visible duration should be equivalent
let min = +self.minimum || 0,
max = +self.maximum || 0,
delta = max - min,
visibleFraction = (delta / self.currentZoomValue) / common.msInS;
console.assert(
Math.abs(visibleFraction - self.visibleDuration) < 0.0001,
"My math should be correct!");

updateYScales();

resolutionScale.domain(self.availableResolutions)
Expand All @@ -433,8 +442,8 @@ angular
// we draw the tiles within the bounds of
// one lane within the main yScale
let start = yScale(self.lanes.indexOf(self.selectedCategory));
yScaleForTiles // inverted y-axis
.domain([self.visualizationYMax, 0])
// inverted y-axis
yScaleForTiles.domain([self.visualizationYMax, 0])
.range([start, start + getTilesGroupHeight()]);
}

Expand Down
2 changes: 2 additions & 0 deletions src/app/d3Bindings/eventDistribution/distributionOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ angular
updateExtent(extent);
}
else {
_lockManualBrush = true;
display();
_lockManualBrush = false;
}

xAxis.update(xScale, [0, miniHeight], true);
Expand Down
Loading

0 comments on commit 7abdfe2

Please sign in to comment.