diff --git a/src/echarts.js b/src/echarts.js index adafffab2a44ea24017c3cef122abf0af4bf6f42..806b056eaa5691e41c33792bd84ffc195ff17eb6 100644 --- a/src/echarts.js +++ b/src/echarts.js @@ -545,7 +545,7 @@ define(function (require) { * Hide loading effect */ echartsProto.hideLoading = function () { - this._zr.remove(this._loadingFX); + this._loadingFX && this._zr.remove(this._loadingFX); this._loadingFX = null; }; diff --git a/src/util/layout.js b/src/util/layout.js index f514f2b29f684fcbac7c248ac56aa54bf0f6f608..64364cb89b8b58bf4d62105fcbbaeff6ad13dcfe 100644 --- a/src/util/layout.js +++ b/src/util/layout.js @@ -29,11 +29,12 @@ define(function(require) { var nextX; var nextY; if (orient === 'horizontal') { - nextX = x + rect.width + (nextChildRect ? (-nextChildRect.x + rect.x) : 0); + var moveX = rect.width + (nextChildRect ? (-nextChildRect.x + rect.x) : 0); + nextX = x + moveX; // Wrap when width exceeds maxWidth or meet a `newline` group if (nextX > maxWidth || child.newline) { x = 0; - nextX = -gap; + nextX = moveX; y += currentLineMaxSize + gap; currentLineMaxSize = 0; } @@ -42,12 +43,13 @@ define(function(require) { } } else { - nextY = y + rect.height + (nextChildRect ? (-nextChildRect.y + rect.y) : 0); + var moveY = rect.height + (nextChildRect ? (-nextChildRect.y + rect.y) : 0); + nextY = y + moveY; // Wrap when width exceeds maxHeight or meet a `newline` group if (nextY > maxHeight || child.newline) { x += currentLineMaxSize + gap; y = 0; - nextY = -gap; + nextY = moveY; currentLineMaxSize = 0; } else {