Skip to content

Commit

Permalink
[tooltip] Fix #3900 and reference #4393 (Fix move tooltip by touchmov…
Browse files Browse the repository at this point in the history
…e in wechat)
  • Loading branch information
100pah committed Nov 8, 2016
1 parent 244c08b commit d4cde45
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/echarts.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,15 @@ define(function (require) {
}
else {
updateMethods.prepareAndUpdate.call(this);
this._zr.refreshImmediately();
// Ensure zr refresh sychronously, and then pixel in canvas can be
// fetched after `setOption`.
this._zr.flush();
this[OPTION_UPDATED] = false;
}

this[IN_MAIN_PROCESS] = false;

flushPendingActions.call(this);
flushPendingActions.call(this, false);
};

/**
Expand Down Expand Up @@ -857,6 +859,7 @@ define(function (require) {
* @param {boolean} [silent=false] Whether trigger event.
*/
echartsProto.dispatchAction = function (payload, silent) {

if (!actions[payload.type]) {
return;
}
Expand All @@ -877,6 +880,14 @@ define(function (require) {

doDispatchAction.call(this, payload, silent);

// Call zr refreshImmediately for these reasons:
// (1) Ensure zr refresh sychronously, and then pixel in canvas can be
// fetched after `dispatchAction`.
// (2) In WeChat embeded browser, `requestAnimationFrame` and `setInterval`
// hang when sliding page (on touch event), which cause that zr does not
// refresh util user interaction finished, which is not expected.
this._zr.flush();

flushPendingActions.call(this, silent);
};

Expand Down

0 comments on commit d4cde45

Please sign in to comment.