Skip to content

Commit

Permalink
Fix a mismatch between sampleIndex and histogramIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
bgirard committed Sep 17, 2012
1 parent 355738f commit fef736d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ RangeSelector.prototype = {
function histogramClick(clickX, clickY) {
clickX = Math.min(clickX, graph.parentNode.getBoundingClientRect().right);
clickX = clickX - graph.parentNode.getBoundingClientRect().left;
var index = self._sampleIndexFromPoint(clickX);
var index = self._histogramIndexFromPoint(clickX);
self._histogram.histogramClick(index);
}
function updateHiliteRectangle(newX, newY) {
Expand Down Expand Up @@ -687,6 +687,13 @@ RangeSelector.prototype = {
var factor = totalSamples / width;
return parseInt(parseFloat(x) * factor);
},
_histogramIndexFromPoint: function RangeSelector__histogramIndexFromPoint(x) {
// XXX this is completely wrong, fix please
var totalSamples = parseFloat(this._histogram._histogramData.length);
var width = parseFloat(this._graph.parentNode.clientWidth);
var factor = totalSamples / width;
return parseInt(parseFloat(x) * factor);
},
};

function videoPaneTimeChange(video) {
Expand Down

0 comments on commit fef736d

Please sign in to comment.