|
@ -428,32 +428,38 @@ Timeline.prototype.focus = function(id, options) { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// Perform one last check at the end to make sure the final vertical
|
|
|
|
|
|
// position is correct
|
|
|
|
|
|
var finalVerticalCallback = function() { |
|
|
|
|
|
|
|
|
// Enforces the final vertical scroll position
|
|
|
|
|
|
var setFinalVerticalPosition = function() { |
|
|
var finalVerticalScroll = getItemVerticalScroll(me, item); |
|
|
var finalVerticalScroll = getItemVerticalScroll(me, item); |
|
|
|
|
|
|
|
|
if(finalVerticalScroll.shouldScroll && finalVerticalScroll.itemTop != initialVerticalScroll.itemTop) { |
|
|
|
|
|
|
|
|
if (finalVerticalScroll.shouldScroll && finalVerticalScroll.itemTop != initialVerticalScroll.itemTop) { |
|
|
me._setScrollTop(-finalVerticalScroll.scrollOffset); |
|
|
me._setScrollTop(-finalVerticalScroll.scrollOffset); |
|
|
me._redraw(); |
|
|
|
|
|
|
|
|
me._redraw(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Perform one last check at the end to make sure the final vertical
|
|
|
|
|
|
// position is correct
|
|
|
|
|
|
var finalVerticalCallback = function() { |
|
|
|
|
|
// Double check we ended at the proper scroll position
|
|
|
|
|
|
setFinalVerticalPosition(); |
|
|
|
|
|
|
|
|
|
|
|
// Let the redraw settle and finalize the position.
|
|
|
|
|
|
setTimeout(setFinalVerticalPosition, 100); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
// calculate the new middle and interval for the window
|
|
|
// calculate the new middle and interval for the window
|
|
|
var middle = (start + end) / 2; |
|
|
var middle = (start + end) / 2; |
|
|
var interval = Math.max((this.range.end - this.range.start), (end - start) * 1.1); |
|
|
|
|
|
|
|
|
var interval = Math.max(this.range.end - this.range.start, (end - start) * 1.1); |
|
|
|
|
|
|
|
|
var animation = (options && options.animation !== undefined) ? options.animation : true; |
|
|
|
|
|
|
|
|
var animation = options && options.animation !== undefined ? options.animation : true; |
|
|
|
|
|
|
|
|
if(!animation) { |
|
|
|
|
|
|
|
|
if (!animation) { |
|
|
// We aren't animating so set a default so that the final callback forces the vertical location
|
|
|
// We aren't animating so set a default so that the final callback forces the vertical location
|
|
|
initialVerticalScroll = {shouldScroll: false, scrollOffset: -1, itemTop: -1}; |
|
|
|
|
|
|
|
|
initialVerticalScroll = { shouldScroll: false, scrollOffset: -1, itemTop: -1 }; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.range.setRange(middle - interval / 2, middle + interval / 2, { animation: animation }, finalVerticalCallback, verticalAnimationFrame); |
|
|
|
|
|
|
|
|
|
|
|
// Let the redraw settle and finalize the position
|
|
|
|
|
|
setTimeout(finalVerticalCallback, 100); |
|
|
|
|
|
|
|
|
this.range.setRange(middle - interval / 2, middle + interval / 2, { animation: animation }, finalVerticalCallback, verticalAnimationFrame); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|