Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions dist/wxcharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down