diff --git a/dist/wxcharts.js b/dist/wxcharts.js index e2fb996..5464a4c 100644 --- a/dist/wxcharts.js +++ b/dist/wxcharts.js @@ -1960,7 +1960,7 @@ Charts.prototype.addEventListener = function (type, listener) { }; Charts.prototype.getCurrentDataIndex = function (e) { - var touches = e.touches && e.touches.length ? e.touches : e.changedTouches; + var touches = e.touches && e.touches.length && e.touches[e.touches.length-1].x? e.touches : e.changedTouches; if (touches && touches.length) { var _touches$ = touches[0], x = _touches$.x, @@ -2008,14 +2008,20 @@ Charts.prototype.showToolTip = function (e) { Charts.prototype.scrollStart = function (e) { if (e.touches[0] && this.opts.enableScroll === true) { - this.scrollOption.startTouchX = e.touches[0].x; + this.scrollOption.startTouchX = e.touches[e.touches.length - 1].x; } }; Charts.prototype.scroll = function (e) { // TODO throtting... if (e.touches[0] && this.opts.enableScroll === true) { - var _distance = e.touches[0].x - this.scrollOption.startTouchX; + let nowitem = {} + e.touches.forEach(el => { + if (el.x) { + nowitem = el + } + }) + var _distance = nowitem.x - this.scrollOption.startTouchX; var currentOffset = this.scrollOption.currentOffset; var validDistance = calValidDistance(currentOffset + _distance, this.chartData, this.config, this.opts);