Fix click on the history timeline

pull/1/head
yflory 4 years ago
parent bf2efa09df
commit 95e6163ae7

@ -474,11 +474,19 @@ define([
render(get(v)); render(get(v));
}); });
*/ */
$(bar).click(function (e) { var $bar = $(bar);
$bar.click(function (e) {
e.stopPropagation(); e.stopPropagation();
if (!$(e.target).is('.cp-history-timeline-bar')) { return; } console.log(e);
var p = e.offsetX / $bar.width(); var $t = $(e.target);
var v = -Math.round((states.length - 1) * (1 - p)); var isEl = $t.is('.cp-history-bar-el');
if (!$t.is('.cp-history-timeline-bar') && !isEl) { return; }
var x = e.offsetX;
if (isEl) {
x += $t.position().left;
}
var p = x / $bar.width();
var v = -Math.floor((states.length - 1) * (1 - p));
render(get(v)); render(get(v));
}); });
$loadMore = $(_loadMore).click(function () { $loadMore = $(_loadMore).click(function () {

Loading…
Cancel
Save