From 95e6163ae7d5194262e89e89c12ec9333aa670fa Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 28 Sep 2020 16:35:06 +0200 Subject: [PATCH] Fix click on the history timeline --- www/common/sframe-common-history.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/www/common/sframe-common-history.js b/www/common/sframe-common-history.js index 016256443..cf4912786 100644 --- a/www/common/sframe-common-history.js +++ b/www/common/sframe-common-history.js @@ -474,11 +474,19 @@ define([ render(get(v)); }); */ - $(bar).click(function (e) { + var $bar = $(bar); + $bar.click(function (e) { e.stopPropagation(); - if (!$(e.target).is('.cp-history-timeline-bar')) { return; } - var p = e.offsetX / $bar.width(); - var v = -Math.round((states.length - 1) * (1 - p)); + console.log(e); + var $t = $(e.target); + 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)); }); $loadMore = $(_loadMore).click(function () {