@@ -900,7 +900,7 @@ return /******/ (function(modules) { // webpackBootstrap
900900 }
901901
902902 var MOUSE_EVENT_NAMES = [
903- 'click', 'dblclick', 'mouseover', 'mouseout', 'globalout'
903+ 'click', 'dblclick', 'mouseover', 'mouseout', 'mousedown', 'mouseup', ' globalout'
904904 ];
905905 /**
906906 * @private
@@ -912,8 +912,8 @@ return /******/ (function(modules) { // webpackBootstrap
912912 var ecModel = this.getModel();
913913 var el = e.target;
914914 if (el && el.dataIndex != null) {
915- var hostModel = el.hostModel || ecModel.getSeriesByIndex(el.seriesIndex);
916- var params = hostModel && hostModel .getDataParams(el.dataIndex) || {};
915+ var dataModel = el.dataModel || ecModel.getSeriesByIndex(el.seriesIndex);
916+ var params = dataModel && dataModel .getDataParams(el.dataIndex) || {};
917917 params.event = e;
918918 params.type = eveName;
919919 this.trigger(eveName, params);
@@ -958,7 +958,7 @@ return /******/ (function(modules) { // webpackBootstrap
958958
959959 this._zr.dispose();
960960
961- instances[this.id] = null ;
961+ delete instances[this.id];
962962 };
963963
964964 zrUtil.mixin(ECharts, Eventful);
@@ -1034,9 +1034,9 @@ return /******/ (function(modules) { // webpackBootstrap
10341034 /**
10351035 * @type {number}
10361036 */
1037- version: '3.1.4 ',
1037+ version: '3.1.5 ',
10381038 dependencies: {
1039- zrender: '3.0.5 '
1039+ zrender: '3.0.6 '
10401040 }
10411041 };
10421042
@@ -4953,10 +4953,10 @@ return /******/ (function(modules) { // webpackBootstrap
49534953
49544954 this.uid = componentUtil.getUID('componentModel');
49554955
4956- this.setReadOnly([
4957- 'type', 'id', 'uid', 'name', 'mainType', 'subType',
4958- 'dependentModels', 'componentIndex'
4959- ]);
4956+ // this.setReadOnly([
4957+ // 'type', 'id', 'uid', 'name', 'mainType', 'subType',
4958+ // 'dependentModels', 'componentIndex'
4959+ // ]);
49604960 }
49614961 );
49624962
@@ -10565,43 +10565,49 @@ return /******/ (function(modules) { // webpackBootstrap
1056510565 getBoundingRect: function () {
1056610566 var rect = this._rect;
1056710567 var style = this.style;
10568- if (!rect) {
10568+ var needsUpdateRect = !rect;
10569+ if (needsUpdateRect) {
1056910570 var path = this.path;
1057010571 if (this.__dirtyPath) {
1057110572 path.beginPath();
1057210573 this.buildPath(path, this.shape);
1057310574 }
1057410575 rect = path.getBoundingRect();
1057510576 }
10576- /**
10577- * Needs update rect with stroke lineWidth when
10578- * 1. Element changes scale or lineWidth
10579- * 2. First create rect
10580- */
10581- if (pathHasStroke(style) && (this.__dirty || !this._rect)) {
10582- var rectWithStroke = this._rectWithStroke
10583- || (this._rectWithStroke = rect.clone());
10584- rectWithStroke.copy(rect);
10585- // FIXME Must after updateTransform
10586- var w = style.lineWidth;
10587- // PENDING, Min line width is needed when line is horizontal or vertical
10588- var lineScale = style.strokeNoScale ? this.getLineScale() : 1;
10589-
10590- // Only add extra hover lineWidth when there are no fill
10591- if (!pathHasFill(style)) {
10592- w = Math.max(w, this.strokeContainThreshold);
10593- }
10594- // Consider line width
10595- // Line scale can't be 0;
10596- if (lineScale > 1e-10) {
10597- rectWithStroke.width += w / lineScale;
10598- rectWithStroke.height += w / lineScale;
10599- rectWithStroke.x -= w / lineScale / 2;
10600- rectWithStroke.y -= w / lineScale / 2;
10577+ this._rect = rect;
10578+
10579+ if (pathHasStroke(style)) {
10580+ // Needs update rect with stroke lineWidth when
10581+ // 1. Element changes scale or lineWidth
10582+ // 2. Shape is changed
10583+ var rectWithStroke = this._rectWithStroke;
10584+ if (this.__dirty || needsUpdateRect) {
10585+ var rectWithStroke = this._rectWithStroke
10586+ || (this._rectWithStroke = rect.clone());
10587+ rectWithStroke.copy(rect);
10588+ // FIXME Must after updateTransform
10589+ var w = style.lineWidth;
10590+ // PENDING, Min line width is needed when line is horizontal or vertical
10591+ var lineScale = style.strokeNoScale ? this.getLineScale() : 1;
10592+
10593+ // Only add extra hover lineWidth when there are no fill
10594+ if (!pathHasFill(style)) {
10595+ w = Math.max(w, this.strokeContainThreshold);
10596+ }
10597+ // Consider line width
10598+ // Line scale can't be 0;
10599+ if (lineScale > 1e-10) {
10600+ rectWithStroke.width += w / lineScale;
10601+ rectWithStroke.height += w / lineScale;
10602+ rectWithStroke.x -= w / lineScale / 2;
10603+ rectWithStroke.y -= w / lineScale / 2;
10604+ }
1060110605 }
10606+
10607+ // Return rect with stroke
1060210608 return rectWithStroke;
1060310609 }
10604- this._rect = rect;
10610+
1060510611 return rect;
1060610612 },
1060710613
@@ -11011,7 +11017,7 @@ return /******/ (function(modules) { // webpackBootstrap
1101111017 */
1101211018 setStyle: function (key, value) {
1101311019 this.style.set(key, value);
11014- this.dirty();
11020+ this.dirty(false );
1101511021 return this;
1101611022 }
1101711023 };
@@ -12101,7 +12107,8 @@ return /******/ (function(modules) { // webpackBootstrap
1210112107 var mathPow = Math.pow;
1210212108 var mathSqrt = Math.sqrt;
1210312109
12104- var EPSILON = 1e-4;
12110+ var EPSILON = 1e-8;
12111+ var EPSILON_NUMERIC = 1e-4;
1210512112
1210612113 var THREE_SQRT = mathSqrt(3);
1210712114 var ONE_THIRD = 1 / 3;
@@ -12367,7 +12374,7 @@ return /******/ (function(modules) { // webpackBootstrap
1236712374
1236812375 // At most 32 iteration
1236912376 for (var i = 0; i < 32; i++) {
12370- if (interval < EPSILON ) {
12377+ if (interval < EPSILON_NUMERIC ) {
1237112378 break;
1237212379 }
1237312380 prev = t - interval;
@@ -12562,7 +12569,7 @@ return /******/ (function(modules) { // webpackBootstrap
1256212569
1256312570 // At most 32 iteration
1256412571 for (var i = 0; i < 32; i++) {
12565- if (interval < EPSILON ) {
12572+ if (interval < EPSILON_NUMERIC ) {
1256612573 break;
1256712574 }
1256812575 var prev = t - interval;
@@ -12699,6 +12706,8 @@ return /******/ (function(modules) { // webpackBootstrap
1269912706 max[1] = mathMax(y0, y1);
1270012707 };
1270112708
12709+ var xDim = [];
12710+ var yDim = [];
1270212711 /**
1270312712 * 从三阶贝塞尔曲线(p0, p1, p2, p3)中计算出最小包围盒,写入`min`和`max`中
1270412713 * @memberOf module:zrender/core/bbox
@@ -12716,34 +12725,36 @@ return /******/ (function(modules) { // webpackBootstrap
1271612725 bbox.fromCubic = function(
1271712726 x0, y0, x1, y1, x2, y2, x3, y3, min, max
1271812727 ) {
12719- var xDim = [];
12720- var yDim = [];
1272112728 var cubicExtrema = curve.cubicExtrema;
1272212729 var cubicAt = curve.cubicAt;
12723- var left, right, top, bottom;
1272412730 var i;
1272512731 var n = cubicExtrema(x0, x1, x2, x3, xDim);
12732+ min[0] = Infinity;
12733+ min[1] = Infinity;
12734+ max[0] = -Infinity;
12735+ max[1] = -Infinity;
1272612736
1272712737 for (i = 0; i < n; i++) {
12728- xDim[i] = cubicAt(x0, x1, x2, x3, xDim[i]);
12738+ var x = cubicAt(x0, x1, x2, x3, xDim[i]);
12739+ min[0] = mathMin(x, min[0]);
12740+ max[0] = mathMax(x, max[0]);
1272912741 }
1273012742 n = cubicExtrema(y0, y1, y2, y3, yDim);
1273112743 for (i = 0; i < n; i++) {
12732- yDim[i] = cubicAt(y0, y1, y2, y3, yDim[i]);
12744+ var y = cubicAt(y0, y1, y2, y3, yDim[i]);
12745+ min[1] = mathMin(y, min[1]);
12746+ max[1] = mathMax(y, max[1]);
1273312747 }
1273412748
12735- xDim.push(x0, x3);
12736- yDim.push(y0, y3);
12749+ min[0] = mathMin(x0, min[0]);
12750+ max[0] = mathMax(x0, max[0]);
12751+ min[0] = mathMin(x3, min[0]);
12752+ max[0] = mathMax(x3, max[0]);
1273712753
12738- left = mathMin.apply(null, xDim);
12739- right = mathMax.apply(null, xDim);
12740- top = mathMin.apply(null, yDim);
12741- bottom = mathMax.apply(null, yDim);
12742-
12743- min[0] = left;
12744- min[1] = top;
12745- max[0] = right;
12746- max[1] = bottom;
12754+ min[1] = mathMin(y0, min[1]);
12755+ max[1] = mathMax(y0, max[1]);
12756+ min[1] = mathMin(y3, min[1]);
12757+ max[1] = mathMax(y3, max[1]);
1274712758 };
1274812759
1274912760 /**
@@ -14131,9 +14142,19 @@ return /******/ (function(modules) { // webpackBootstrap
1413114142 getBoundingRect: function () {
1413214143 if (!this._rect) {
1413314144 var style = this.style;
14145+ var textVerticalAlign = style.textVerticalAlign;
1413414146 var rect = textContain.getBoundingRect(
14135- style.text + '', style.textFont || style.font, style.textAlign, style.textBaseline
14147+ style.text + '', style.textFont || style.font, style.textAlign,
14148+ textVerticalAlign ? 'top' : style.textBaseline
1413614149 );
14150+ switch (textVerticalAlign) {
14151+ case 'middle':
14152+ rect.y -= rect.height / 2;
14153+ break;
14154+ case 'bottom':
14155+ rect.y -= rect.height;
14156+ break;
14157+ }
1413714158 rect.x += style.x || 0;
1413814159 rect.y += style.y || 0;
1413914160 this._rect = rect;
@@ -15029,7 +15050,7 @@ return /******/ (function(modules) { // webpackBootstrap
1502915050 /**
1503015051 * @type {string}
1503115052 */
15032- zrender.version = '3.0.5 ';
15053+ zrender.version = '3.0.6 ';
1503315054
1503415055 /**
1503515056 * @param {HTMLElement} dom
@@ -18899,8 +18920,14 @@ return /******/ (function(modules) { // webpackBootstrap
1889918920 var minDist = Number.MAX_VALUE;
1890018921 var nearestIdx = -1;
1890118922 for (var i = 0, len = this.count(); i < len; i++) {
18902- var dist = Math.abs(this.get(dim, i, stack) - value);
18903- if (dist <= minDist) {
18923+ var diff = value - this.get(dim, i, stack);
18924+ var dist = Math.abs(diff);
18925+ if (dist < minDist
18926+ // For the case of two data are same on xAxis, which has sequence data.
18927+ // Show the nearest index
18928+ // https://github.com/ecomfe/echarts/issues/2869
18929+ || (dist === minDist && diff > 0)
18930+ ) {
1890418931 minDist = dist;
1890518932 nearestIdx = i;
1890618933 }
@@ -26094,11 +26121,12 @@ return /******/ (function(modules) { // webpackBootstrap
2609426121 continue;
2609526122 }
2609626123 var deltaY = Math.abs(list[i].y - cy);
26097- var length = list[i].length;
26124+ var length = list[i].len;
26125+ var length2 = list[i].len2;
2609826126 var deltaX = (deltaY < r + length)
2609926127 ? Math.sqrt(
26100- (r + length + 20 ) * (r + length + 20 )
26101- - Math.pow(list[i].y - cy, 2)
26128+ (r + length + length2 ) * (r + length + length2 )
26129+ - deltaY * deltaY
2610226130 )
2610326131 : Math.abs(list[i].x - cx);
2610426132 if (isDownList && deltaX >= lastDeltaX) {
@@ -26138,8 +26166,8 @@ return /******/ (function(modules) { // webpackBootstrap
2613826166 upList.push(list[i]);
2613926167 }
2614026168 }
26141- changeX(downList, true, cx, cy, r, dir);
2614226169 changeX(upList, false, cx, cy, r, dir);
26170+ changeX(downList, true, cx, cy, r, dir);
2614326171 }
2614426172
2614526173 function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight) {
@@ -26154,8 +26182,8 @@ return /******/ (function(modules) { // webpackBootstrap
2615426182 }
2615526183 }
2615626184
26157- adjustSingleSide(leftList, cx, cy, r, -1, viewWidth, viewHeight);
2615826185 adjustSingleSide(rightList, cx, cy, r, 1, viewWidth, viewHeight);
26186+ adjustSingleSide(leftList, cx, cy, r, -1, viewWidth, viewHeight);
2615926187
2616026188 for (var i = 0; i < labelLayoutList.length; i++) {
2616126189 var linePoints = labelLayoutList[i].linePoints;
@@ -26214,15 +26242,13 @@ return /******/ (function(modules) { // webpackBootstrap
2621426242 var x1 = (isLabelInside ? layout.r / 2 * dx : layout.r * dx) + cx;
2621526243 var y1 = (isLabelInside ? layout.r / 2 * dy : layout.r * dy) + cy;
2621626244
26217- // For roseType
26218- labelLineLen += r - layout.r;
26219-
2622026245 textX = x1 + dx * 3;
2622126246 textY = y1 + dy * 3;
2622226247
2622326248 if (!isLabelInside) {
26224- var x2 = x1 + dx * labelLineLen;
26225- var y2 = y1 + dy * labelLineLen;
26249+ // For roseType
26250+ var x2 = x1 + dx * (labelLineLen + r - layout.r);
26251+ var y2 = y1 + dy * (labelLineLen + r - layout.r);
2622626252 var x3 = x2 + ((dx < 0 ? -1 : 1) * labelLineLen2);
2622726253 var y3 = y2;
2622826254
@@ -26248,8 +26274,8 @@ return /******/ (function(modules) { // webpackBootstrap
2624826274 y: textY,
2624926275 position: labelPosition,
2625026276 height: textRect.height,
26251- length : labelLineLen,
26252- length2 : labelLineLen2,
26277+ len : labelLineLen,
26278+ len2 : labelLineLen2,
2625326279 linePoints: linePoints,
2625426280 textAlign: textAlign,
2625526281 verticalAlign: 'middle',
0 commit comments