echarts 3.5.1 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/LICENSE +21 -18
  2. package/README.md +10 -0
  3. package/dist/echarts.common.js +11010 -9830
  4. package/dist/echarts.common.min.js +13 -13
  5. package/dist/echarts.js +13291 -10852
  6. package/dist/echarts.min.js +22 -21
  7. package/dist/echarts.simple.js +9904 -8990
  8. package/dist/echarts.simple.min.js +9 -10
  9. package/index.js +1 -0
  10. package/lib/ExtensionAPI.js +2 -4
  11. package/lib/chart/bar/BarView.js +141 -49
  12. package/lib/chart/bar/BaseBarSeries.js +2 -6
  13. package/lib/chart/bar.js +1 -0
  14. package/lib/chart/boxplot/BoxplotSeries.js +1 -1
  15. package/lib/chart/boxplot/boxplotLayout.js +23 -7
  16. package/lib/chart/candlestick/CandlestickSeries.js +3 -22
  17. package/lib/chart/candlestick/candlestickLayout.js +23 -7
  18. package/lib/chart/custom.js +442 -0
  19. package/lib/chart/funnel/funnelLayout.js +10 -3
  20. package/lib/chart/gauge/GaugeView.js +1 -1
  21. package/lib/chart/graph/GraphView.js +15 -9
  22. package/lib/chart/graph/categoryVisual.js +3 -2
  23. package/lib/chart/heatmap/HeatmapLayer.js +1 -1
  24. package/lib/chart/heatmap/HeatmapView.js +75 -73
  25. package/lib/chart/helper/Symbol.js +8 -31
  26. package/lib/chart/helper/createListFromArray.js +15 -10
  27. package/lib/chart/helper/labelHelper.js +48 -0
  28. package/lib/chart/helper/whiskerBoxCommon.js +25 -44
  29. package/lib/chart/map/mapDataStatistic.js +9 -8
  30. package/lib/chart/parallel/ParallelSeries.js +2 -0
  31. package/lib/chart/parallel/ParallelView.js +13 -12
  32. package/lib/chart/parallel/parallelVisual.js +9 -1
  33. package/lib/chart/pie/pieLayout.js +25 -17
  34. package/lib/chart/radar/RadarSeries.js +1 -1
  35. package/lib/chart/sankey/sankeyLayout.js +1 -1
  36. package/lib/chart/scatter/ScatterSeries.js +2 -3
  37. package/lib/chart/themeRiver/ThemeRiverSeries.js +6 -5
  38. package/lib/chart/themeRiver/themeRiverVisual.js +1 -1
  39. package/lib/chart/treemap/TreemapSeries.js +3 -3
  40. package/lib/chart/treemap/TreemapView.js +1 -1
  41. package/lib/chart/treemap/treemapLayout.js +6 -1
  42. package/lib/component/axis/AxisBuilder.js +53 -34
  43. package/lib/component/axis/ParallelAxisView.js +45 -37
  44. package/lib/component/axisPointer/AxisPointerModel.js +1 -1
  45. package/lib/component/axisPointer/BaseAxisPointer.js +20 -15
  46. package/lib/component/axisPointer/CartesianAxisPointer.js +9 -6
  47. package/lib/component/axisPointer/PolarAxisPointer.js +10 -8
  48. package/lib/component/axisPointer/SingleAxisPointer.js +11 -7
  49. package/lib/component/axisPointer/axisTrigger.js +87 -72
  50. package/lib/component/axisPointer/viewHelper.js +6 -3
  51. package/lib/component/axisPointer.js +2 -2
  52. package/lib/component/brush/BrushModel.js +6 -4
  53. package/lib/component/brush/BrushView.js +1 -1
  54. package/lib/component/brush/visualEncoding.js +6 -4
  55. package/lib/component/calendar/CalendarView.js +5 -5
  56. package/lib/component/dataZoom/AxisProxy.js +76 -13
  57. package/lib/component/dataZoom/DataZoomModel.js +21 -5
  58. package/lib/component/dataZoom/InsideZoomModel.js +4 -1
  59. package/lib/component/dataZoom/InsideZoomView.js +17 -27
  60. package/lib/component/dataZoom/SliderZoomView.js +63 -26
  61. package/lib/component/dataZoom/roams.js +9 -4
  62. package/lib/component/graphic.js +13 -12
  63. package/lib/component/helper/BrushController.js +75 -114
  64. package/lib/component/helper/BrushTargetManager.js +16 -8
  65. package/lib/component/helper/MapDraw.js +25 -11
  66. package/lib/component/helper/RoamController.js +111 -139
  67. package/lib/component/helper/brushHelper.js +25 -213
  68. package/lib/component/helper/cursorHelper.js +21 -0
  69. package/lib/component/helper/roamHelper.js +54 -0
  70. package/lib/component/helper/selectableMixin.js +7 -7
  71. package/lib/component/helper/sliderMove.js +66 -37
  72. package/lib/component/legend/LegendView.js +6 -6
  73. package/lib/component/legend/legendAction.js +1 -1
  74. package/lib/component/marker/MarkAreaView.js +3 -6
  75. package/lib/component/marker/MarkLineView.js +3 -5
  76. package/lib/component/marker/MarkPointView.js +3 -5
  77. package/lib/component/marker/MarkerView.js +10 -12
  78. package/lib/component/marker/markerHelper.js +1 -1
  79. package/lib/component/parallel.js +94 -29
  80. package/lib/component/polar.js +5 -0
  81. package/lib/component/timeline/SliderTimelineView.js +1 -1
  82. package/lib/component/toolbox/feature/Brush.js +7 -0
  83. package/lib/component/toolbox/feature/DataZoom.js +17 -4
  84. package/lib/component/tooltip/TooltipView.js +92 -20
  85. package/lib/component/visualMap/ContinuousView.js +6 -4
  86. package/lib/coord/Axis.js +34 -2
  87. package/lib/coord/axisDefault.js +4 -1
  88. package/lib/coord/axisHelper.js +32 -26
  89. package/lib/coord/axisModelCommonMixin.js +1 -1
  90. package/lib/coord/calendar/Calendar.js +14 -17
  91. package/lib/coord/calendar/prepareCustom.js +31 -0
  92. package/lib/coord/cartesian/Axis2D.js +0 -12
  93. package/lib/coord/cartesian/Cartesian2D.js +1 -0
  94. package/lib/coord/cartesian/Grid.js +5 -2
  95. package/lib/coord/cartesian/prepareCustom.js +36 -0
  96. package/lib/coord/geo/Geo.js +9 -14
  97. package/lib/coord/geo/GeoModel.js +5 -5
  98. package/lib/coord/geo/geoCreator.js +3 -3
  99. package/lib/coord/geo/parseGeoJson.js +11 -4
  100. package/lib/coord/geo/prepareCustom.js +36 -0
  101. package/lib/coord/parallel/Parallel.js +225 -101
  102. package/lib/coord/parallel/ParallelModel.js +7 -1
  103. package/lib/coord/polar/Polar.js +2 -1
  104. package/lib/coord/polar/prepareCustom.js +53 -0
  105. package/lib/coord/single/Single.js +9 -8
  106. package/lib/coord/single/SingleAxis.js +0 -27
  107. package/lib/coord/single/prepareCustom.js +33 -0
  108. package/lib/data/DataDiffer.js +2 -1
  109. package/lib/data/Graph.js +11 -7
  110. package/lib/data/List.js +59 -20
  111. package/lib/data/helper/completeDimensions.js +184 -23
  112. package/lib/echarts.js +68 -36
  113. package/lib/helper.js +1 -8
  114. package/lib/layout/barGrid.js +91 -19
  115. package/lib/layout/barPolar.js +286 -0
  116. package/lib/layout/points.js +22 -16
  117. package/lib/model/Global.js +34 -31
  118. package/lib/model/Series.js +41 -29
  119. package/lib/model/globalDefault.js +4 -1
  120. package/lib/model/mixin/colorPalette.js +2 -1
  121. package/lib/model/mixin/textStyle.js +7 -13
  122. package/lib/scale/Interval.js +46 -76
  123. package/lib/scale/Log.js +5 -7
  124. package/lib/scale/Scale.js +10 -1
  125. package/lib/scale/Time.js +34 -12
  126. package/lib/scale/helper.js +93 -0
  127. package/lib/util/format.js +20 -9
  128. package/lib/util/graphic.js +70 -8
  129. package/lib/util/layout.js +7 -3
  130. package/lib/util/model.js +63 -7
  131. package/lib/util/number.js +59 -19
  132. package/lib/util/throttle.js +14 -3
  133. package/map/js/world.js +1 -1
  134. package/map/json/world.json +1 -1
  135. package/package.json +3 -3
  136. package/src/ExtensionAPI.js +2 -4
  137. package/src/chart/bar/BarView.js +141 -49
  138. package/src/chart/bar/BaseBarSeries.js +2 -6
  139. package/src/chart/bar.js +1 -0
  140. package/src/chart/boxplot/BoxplotSeries.js +1 -1
  141. package/src/chart/boxplot/boxplotLayout.js +23 -7
  142. package/src/chart/candlestick/CandlestickSeries.js +3 -22
  143. package/src/chart/candlestick/candlestickLayout.js +23 -7
  144. package/src/chart/custom.js +442 -0
  145. package/src/chart/funnel/funnelLayout.js +10 -4
  146. package/src/chart/gauge/GaugeView.js +1 -1
  147. package/src/chart/graph/GraphView.js +15 -9
  148. package/src/chart/graph/categoryVisual.js +3 -2
  149. package/src/chart/heatmap/HeatmapLayer.js +1 -1
  150. package/src/chart/heatmap/HeatmapView.js +75 -73
  151. package/src/chart/helper/Symbol.js +8 -31
  152. package/src/chart/helper/createListFromArray.js +15 -10
  153. package/src/chart/helper/labelHelper.js +49 -0
  154. package/src/chart/helper/whiskerBoxCommon.js +25 -44
  155. package/src/chart/map/mapDataStatistic.js +9 -8
  156. package/src/chart/parallel/ParallelSeries.js +2 -0
  157. package/src/chart/parallel/ParallelView.js +13 -12
  158. package/src/chart/parallel/parallelVisual.js +9 -1
  159. package/src/chart/pie/pieLayout.js +25 -17
  160. package/src/chart/radar/RadarSeries.js +1 -1
  161. package/src/chart/sankey/sankeyLayout.js +1 -1
  162. package/src/chart/scatter/ScatterSeries.js +2 -3
  163. package/src/chart/themeRiver/ThemeRiverSeries.js +6 -5
  164. package/src/chart/themeRiver/themeRiverVisual.js +1 -1
  165. package/src/chart/treemap/TreemapSeries.js +3 -3
  166. package/src/chart/treemap/TreemapView.js +1 -1
  167. package/src/chart/treemap/treemapLayout.js +6 -1
  168. package/src/component/axis/AxisBuilder.js +53 -34
  169. package/src/component/axis/ParallelAxisView.js +45 -37
  170. package/src/component/axisPointer/AxisPointerModel.js +1 -1
  171. package/src/component/axisPointer/BaseAxisPointer.js +20 -15
  172. package/src/component/axisPointer/CartesianAxisPointer.js +9 -6
  173. package/src/component/axisPointer/PolarAxisPointer.js +10 -8
  174. package/src/component/axisPointer/SingleAxisPointer.js +11 -7
  175. package/src/component/axisPointer/axisTrigger.js +87 -72
  176. package/src/component/axisPointer/viewHelper.js +6 -3
  177. package/src/component/axisPointer.js +2 -2
  178. package/src/component/brush/BrushModel.js +6 -4
  179. package/src/component/brush/BrushView.js +1 -1
  180. package/src/component/brush/visualEncoding.js +6 -4
  181. package/src/component/calendar/CalendarView.js +5 -5
  182. package/src/component/dataZoom/AxisProxy.js +76 -13
  183. package/src/component/dataZoom/DataZoomModel.js +21 -5
  184. package/src/component/dataZoom/InsideZoomModel.js +4 -1
  185. package/src/component/dataZoom/InsideZoomView.js +17 -27
  186. package/src/component/dataZoom/SliderZoomView.js +63 -26
  187. package/src/component/dataZoom/roams.js +9 -4
  188. package/src/component/graphic.js +13 -12
  189. package/src/component/helper/BrushController.js +75 -114
  190. package/src/component/helper/BrushTargetManager.js +16 -8
  191. package/src/component/helper/MapDraw.js +25 -11
  192. package/src/component/helper/RoamController.js +111 -139
  193. package/src/component/helper/brushHelper.js +41 -0
  194. package/src/component/helper/cursorHelper.js +22 -0
  195. package/src/component/helper/roamHelper.js +55 -0
  196. package/src/component/helper/selectableMixin.js +7 -7
  197. package/src/component/helper/sliderMove.js +66 -37
  198. package/src/component/legend/LegendView.js +6 -6
  199. package/src/component/legend/legendAction.js +1 -1
  200. package/src/component/marker/MarkAreaView.js +3 -6
  201. package/src/component/marker/MarkLineView.js +3 -5
  202. package/src/component/marker/MarkPointView.js +3 -5
  203. package/src/component/marker/MarkerView.js +10 -12
  204. package/src/component/marker/markerHelper.js +1 -1
  205. package/src/component/parallel.js +94 -29
  206. package/src/component/polar.js +5 -0
  207. package/src/component/timeline/SliderTimelineView.js +1 -1
  208. package/src/component/toolbox/feature/Brush.js +7 -0
  209. package/src/component/toolbox/feature/DataZoom.js +17 -4
  210. package/src/component/tooltip/TooltipView.js +92 -20
  211. package/src/component/visualMap/ContinuousView.js +6 -4
  212. package/src/coord/Axis.js +34 -2
  213. package/src/coord/axisDefault.js +4 -1
  214. package/src/coord/axisHelper.js +32 -26
  215. package/src/coord/axisModelCommonMixin.js +1 -1
  216. package/src/coord/calendar/Calendar.js +14 -17
  217. package/src/coord/calendar/prepareCustom.js +32 -0
  218. package/src/coord/cartesian/Axis2D.js +0 -12
  219. package/src/coord/cartesian/Cartesian2D.js +1 -0
  220. package/src/coord/cartesian/Grid.js +5 -2
  221. package/src/coord/cartesian/prepareCustom.js +37 -0
  222. package/src/coord/geo/Geo.js +9 -14
  223. package/src/coord/geo/GeoModel.js +5 -5
  224. package/src/coord/geo/geoCreator.js +3 -3
  225. package/src/coord/geo/parseGeoJson.js +11 -4
  226. package/src/coord/geo/prepareCustom.js +37 -0
  227. package/src/coord/parallel/Parallel.js +225 -101
  228. package/src/coord/parallel/ParallelModel.js +7 -1
  229. package/src/coord/polar/Polar.js +2 -1
  230. package/src/coord/polar/prepareCustom.js +54 -0
  231. package/src/coord/single/Single.js +9 -8
  232. package/src/coord/single/SingleAxis.js +0 -27
  233. package/src/coord/single/prepareCustom.js +34 -0
  234. package/src/data/DataDiffer.js +2 -1
  235. package/src/data/Graph.js +11 -7
  236. package/src/data/List.js +59 -20
  237. package/src/data/helper/completeDimensions.js +184 -23
  238. package/src/echarts.js +68 -36
  239. package/src/helper.js +1 -8
  240. package/src/layout/barGrid.js +91 -19
  241. package/src/layout/barPolar.js +287 -0
  242. package/src/layout/points.js +22 -16
  243. package/src/model/Global.js +34 -31
  244. package/src/model/Series.js +41 -29
  245. package/src/model/globalDefault.js +4 -1
  246. package/src/model/mixin/colorPalette.js +2 -1
  247. package/src/model/mixin/textStyle.js +7 -13
  248. package/src/scale/Interval.js +46 -76
  249. package/src/scale/Log.js +5 -7
  250. package/src/scale/Scale.js +10 -1
  251. package/src/scale/Time.js +34 -12
  252. package/src/scale/helper.js +94 -0
  253. package/src/util/format.js +20 -9
  254. package/src/util/graphic.js +70 -8
  255. package/src/util/layout.js +7 -3
  256. package/src/util/model.js +63 -7
  257. package/src/util/number.js +59 -19
  258. package/src/util/throttle.js +14 -3
  259. package/src/coord/cartesian/axisLabelInterval.js +0 -26
  260. package/theme/default.js +0 -23
  261. package/theme/halloween.js +0 -528
@@ -8,7 +8,6 @@
8
8
 
9
9
  var Eventful = require('zrender/lib/mixin/Eventful');
10
10
  var zrUtil = require('zrender/lib/core/util');
11
- var BoundingRect = require('zrender/lib/core/BoundingRect');
12
11
  var graphic = require('../../util/graphic');
13
12
  var interactionMutex = require('./interactionMutex');
14
13
  var DataDiffer = require('../../data/DataDiffer');
@@ -138,7 +137,7 @@
138
137
  this._creatingCover;
139
138
 
140
139
  /**
141
- * true means global panel
140
+ * `true` means global panel
142
141
  * @private
143
142
  * @type {module:zrender/container/Group|boolean}
144
143
  */
@@ -193,6 +192,7 @@
193
192
  * @param {number} [brushOption.brushStyle.lineWidth]
194
193
  * @param {string} [brushOption.brushStyle.stroke]
195
194
  * @param {string} [brushOption.brushStyle.fill]
195
+ * @param {number} [brushOption.z]
196
196
  */
197
197
  enableBrush: function (brushOption) {
198
198
  if (__DEV__) {
@@ -209,52 +209,28 @@
209
209
  * @param {Array.<Object>} panelOpts If not pass, it is global brush.
210
210
  * Each items: {
211
211
  * panelId, // mandatory.
212
- * rect, // mandatory.
213
- * defaultBrushType // optional, only used when brushType is 'auto'.
212
+ * clipPath, // mandatory. function.
213
+ * isTargetByCursor, // mandatory. function.
214
+ * defaultBrushType, // optional, only used when brushType is 'auto'.
215
+ * getLinearBrushOtherExtent, // optional. function.
214
216
  * }
215
217
  */
216
218
  setPanels: function (panelOpts) {
217
- var oldPanels = this._panels || {};
218
- var newPanels = this._panels = panelOpts && panelOpts.length && {};
219
- var thisGroup = this.group;
220
-
221
- newPanels && each(panelOpts, function (panelOpt) {
222
- var panelId = panelOpt.panelId;
223
- var panel = oldPanels[panelId];
224
- if (!panel) {
225
- panel = new graphic.Rect({
226
- silent: true,
227
- invisible: true
228
- });
229
- thisGroup.add(panel);
230
- }
231
-
232
- var rect = panelOpt.rect;
233
- // Using BoundingRect to normalize negative width/height.
234
- if (!(rect instanceof BoundingRect)) {
235
- rect = BoundingRect.create(rect);
236
- }
237
-
238
- panel.attr('shape', rect.plain());
239
- panel.__brushPanelId = panelId;
240
- panel.__defaultBrushType = panelOpt.defaultBrushType;
241
- newPanels[panelId] = panel;
242
- oldPanels[panelId] = null;
243
- });
244
-
245
- each(oldPanels, function (panel) {
246
- panel && thisGroup.remove(panel);
247
- });
248
-
219
+ if (panelOpts && panelOpts.length) {
220
+ var panels = this._panels = {};
221
+ zrUtil.each(panelOpts, function (panelOpts) {
222
+ panels[panelOpts.panelId] = zrUtil.clone(panelOpts);
223
+ });
224
+ }
225
+ else {
226
+ this._panels = null;
227
+ }
249
228
  return this;
250
229
  },
251
230
 
252
231
  /**
253
232
  * @param {Object} [opt]
254
233
  * @return {boolean} [opt.enableGlobalPan=false]
255
- * @return {boolean} [opt.position=[0, 0]]
256
- * @return {boolean} [opt.rotation=0]
257
- * @return {boolean} [opt.scale=[1, 1]]
258
234
  */
259
235
  mount: function (opt) {
260
236
  opt = opt || {};
@@ -273,6 +249,7 @@
273
249
  rotation: opt.rotation || 0,
274
250
  scale: opt.scale || [1, 1]
275
251
  });
252
+ this._transform = thisGroup.getLocalTransform();
276
253
 
277
254
  return this;
278
255
  },
@@ -379,7 +356,6 @@
379
356
 
380
357
  zrUtil.mixin(BrushController, Eventful);
381
358
 
382
-
383
359
  function doEnableBrush(controller, brushOption) {
384
360
  var zr = controller._zr;
385
361
 
@@ -410,8 +386,8 @@
410
386
 
411
387
  function createCover(controller, brushOption) {
412
388
  var cover = coverRenderers[brushOption.brushType].createCover(controller, brushOption);
413
- updateZ(cover);
414
389
  cover.__brushOption = brushOption;
390
+ updateZ(cover, brushOption);
415
391
  controller.group.add(cover);
416
392
  return cover;
417
393
  }
@@ -420,7 +396,7 @@
420
396
  var coverRenderer = getCoverRenderer(creatingCover);
421
397
  if (coverRenderer.endCreating) {
422
398
  coverRenderer.endCreating(controller, creatingCover);
423
- updateZ(creatingCover);
399
+ updateZ(creatingCover, creatingCover.__brushOption);
424
400
  }
425
401
  return creatingCover;
426
402
  }
@@ -432,10 +408,12 @@
432
408
  );
433
409
  }
434
410
 
435
- function updateZ(group) {
436
- group.traverse(function (el) {
437
- el.z = COVER_Z;
438
- el.z2 = COVER_Z; // Consider in given container.
411
+ function updateZ(cover, brushOption) {
412
+ var z = brushOption.z;
413
+ z == null && (z = COVER_Z);
414
+ cover.traverse(function (el) {
415
+ el.z = z;
416
+ el.z2 = z; // Consider in given container.
439
417
  });
440
418
  }
441
419
 
@@ -448,18 +426,21 @@
448
426
  return coverRenderers[cover.__brushOption.brushType];
449
427
  }
450
428
 
451
- function getPanelByPoint(controller, x, y) {
429
+ // return target panel or `true` (means global panel)
430
+ function getPanelByPoint(controller, e, localCursorPoint) {
452
431
  var panels = controller._panels;
453
432
  if (!panels) {
454
433
  return true; // Global panel
455
434
  }
456
435
  var panel;
436
+ var transform = controller._transform;
457
437
  each(panels, function (pn) {
458
- pn.contain(x, y) && (panel = pn);
438
+ pn.isTargetByCursor(e, localCursorPoint, transform) && (panel = pn);
459
439
  });
460
440
  return panel;
461
441
  }
462
442
 
443
+ // Return a panel or true
463
444
  function getPanelByCover(controller, cover) {
464
445
  var panels = controller._panels;
465
446
  if (!panels) {
@@ -486,7 +467,6 @@
486
467
  var areas = map(controller._covers, function (cover) {
487
468
  var brushOption = cover.__brushOption;
488
469
  var range = zrUtil.clone(brushOption.range);
489
-
490
470
  return {
491
471
  brushType: brushOption.brushType,
492
472
  panelId: brushOption.panelId,
@@ -696,21 +676,10 @@
696
676
 
697
677
  function clipByPanel(controller, cover, data) {
698
678
  var panel = getPanelByCover(controller, cover);
699
- if (panel === true) { // Global panel
700
- return zrUtil.clone(data);
701
- }
702
-
703
- var panelRect = panel.getBoundingRect();
704
679
 
705
- return zrUtil.map(data, function (point) {
706
- var x = point[0];
707
- x = mathMax(x, panelRect.x);
708
- x = mathMin(x, panelRect.x + panelRect.width);
709
- var y = point[1];
710
- y = mathMax(y, panelRect.y);
711
- y = mathMin(y, panelRect.y + panelRect.height);
712
- return [x, y];
713
- });
680
+ return (panel && panel !== true)
681
+ ? panel.clipPath(data, controller._transform)
682
+ : zrUtil.clone(data);
714
683
  }
715
684
 
716
685
  function pointsToRect(points) {
@@ -727,34 +696,33 @@
727
696
  };
728
697
  }
729
698
 
730
- function resetCursor(controller, e) {
731
- var x = e.offsetX;
732
- var y = e.offsetY;
733
- var zr = controller._zr;
699
+ function resetCursor(controller, e, localCursorPoint) {
700
+ // Check active
701
+ if (!controller._brushType) {
702
+ return;
703
+ }
734
704
 
735
- if (controller._brushType) { // If active
736
- var panels = controller._panels;
737
- var covers = controller._covers;
738
- var inCover;
705
+ var zr = controller._zr;
706
+ var covers = controller._covers;
707
+ var currPanel = getPanelByPoint(controller, e, localCursorPoint);
739
708
 
709
+ // Check whether in covers.
710
+ if (!controller._dragging) {
740
711
  for (var i = 0; i < covers.length; i++) {
741
- if (coverRenderers[covers[i].__brushOption.brushType].contain(covers[i], x, y)) {
742
- inCover = true;
743
- break;
744
- }
745
- }
746
-
747
- if (!inCover) {
748
- if (panels) { // Brush on panels
749
- each(panels, function (panel) {
750
- panel.contain(x, y) && zr.setCursorStyle('crosshair');
751
- });
752
- }
753
- else { // Global brush
754
- zr.setCursorStyle('crosshair');
712
+ var brushOption = covers[i].__brushOption;
713
+ if (currPanel
714
+ && (currPanel === true || brushOption.panelId === currPanel.panelId)
715
+ && coverRenderers[brushOption.brushType].contain(
716
+ covers[i], localCursorPoint[0], localCursorPoint[1]
717
+ )
718
+ ) {
719
+ // Use cursor style set on cover.
720
+ return;
755
721
  }
756
722
  }
757
723
  }
724
+
725
+ currPanel && zr.setCursorStyle('crosshair');
758
726
  }
759
727
 
760
728
  function preventDefault(e) {
@@ -766,15 +734,13 @@
766
734
  return cover.childOfName('main').contain(x, y);
767
735
  }
768
736
 
769
- function updateCoverByMouse(controller, e, isEnd) {
770
- var x = e.offsetX;
771
- var y = e.offsetY;
737
+ function updateCoverByMouse(controller, e, localCursorPoint, isEnd) {
772
738
  var creatingCover = controller._creatingCover;
773
739
  var panel = controller._creatingPanel;
774
740
  var thisBrushOption = controller._brushOption;
775
741
  var eventParams;
776
742
 
777
- controller._track.push(controller.group.transformCoordToLocal(x, y));
743
+ controller._track.push(localCursorPoint.slice());
778
744
 
779
745
  if (shouldShowCover(controller) || creatingCover) {
780
746
 
@@ -782,7 +748,7 @@
782
748
  thisBrushOption.brushMode === 'single' && clearCovers(controller);
783
749
  var brushOption = zrUtil.clone(thisBrushOption);
784
750
  brushOption.brushType = determineBrushType(brushOption.brushType, panel);
785
- brushOption.panelId = panel === true ? null : panel.__brushPanelId;
751
+ brushOption.panelId = panel === true ? null : panel.panelId;
786
752
  creatingCover = controller._creatingCover = createCover(controller, brushOption);
787
753
  controller._covers.push(creatingCover);
788
754
  }
@@ -815,7 +781,7 @@
815
781
  // clicks (for example, click on other component and do not expect covers
816
782
  // disappear).
817
783
  // Only some cover removed, trigger action, but not every click trigger action.
818
- if (getPanelByPoint(controller, x, y) && clearCovers(controller)) {
784
+ if (getPanelByPoint(controller, e, localCursorPoint) && clearCovers(controller)) {
819
785
  eventParams = {isEnd: isEnd, removeOnClick: true};
820
786
  }
821
787
  }
@@ -827,11 +793,11 @@
827
793
  if (brushType === 'auto') {
828
794
  if (__DEV__) {
829
795
  zrUtil.assert(
830
- panel && panel.__defaultBrushType,
796
+ panel && panel.defaultBrushType,
831
797
  'MUST have defaultBrushType when brushType is "atuo"'
832
798
  );
833
799
  }
834
- return panel.__defaultBrushType;
800
+ return panel.defaultBrushType;
835
801
  }
836
802
  return brushType;
837
803
  }
@@ -848,28 +814,28 @@
848
814
 
849
815
  preventDefault(e);
850
816
 
851
- var x = e.offsetX;
852
- var y = e.offsetY;
817
+ var localCursorPoint = this.group.transformCoordToLocal(e.offsetX, e.offsetY);
853
818
 
854
819
  this._creatingCover = null;
855
- var panel = this._creatingPanel = getPanelByPoint(this, x, y);
820
+ var panel = this._creatingPanel = getPanelByPoint(this, e, localCursorPoint);
856
821
 
857
822
  if (panel) {
858
823
  this._dragging = true;
859
- this._track = [this.group.transformCoordToLocal(x, y)];
824
+ this._track = [localCursorPoint.slice()];
860
825
  }
861
826
  }
862
827
  },
863
828
 
864
829
  mousemove: function (e) {
865
- // set Cursor
866
- resetCursor(this, e);
830
+ var localCursorPoint = this.group.transformCoordToLocal(e.offsetX, e.offsetY);
831
+
832
+ resetCursor(this, e, localCursorPoint);
867
833
 
868
834
  if (this._dragging) {
869
835
 
870
836
  preventDefault(e);
871
837
 
872
- var eventParams = updateCoverByMouse(this, e, false);
838
+ var eventParams = updateCoverByMouse(this, e, localCursorPoint, false);
873
839
 
874
840
  eventParams && trigger(this, eventParams);
875
841
  }
@@ -887,7 +853,8 @@
887
853
 
888
854
  preventDefault(e);
889
855
 
890
- var eventParams = updateCoverByMouse(this, e, true);
856
+ var localCursorPoint = this.group.transformCoordToLocal(e.offsetX, e.offsetY);
857
+ var eventParams = updateCoverByMouse(this, e, localCursorPoint, true);
891
858
 
892
859
  this._dragging = false;
893
860
  this._track = [];
@@ -1001,23 +968,17 @@
1001
968
  return [min, max];
1002
969
  },
1003
970
  updateCoverShape: function (controller, cover, localRange, brushOption) {
1004
- var brushWidth = brushOption.brushStyle.width;
1005
971
  var otherExtent;
1006
972
  // If brushWidth not specified, fit the panel.
1007
- if (brushWidth == null) {
1008
- var panel = getPanelByCover(controller, cover);
1009
- var base = 0;
1010
- if (panel !== true) {
1011
- var rect = panel.getBoundingRect();
1012
- brushWidth = xyIndex ? rect.width : rect.height;
1013
- base = xyIndex ? rect.x : rect.y;
1014
- }
1015
- // FIXME
1016
- // do not support global panel yet.
1017
- otherExtent = [base, base + (brushWidth || 0)];
973
+ var panel = getPanelByCover(controller, cover);
974
+ if (panel !== true && panel.getLinearBrushOtherExtent) {
975
+ otherExtent = panel.getLinearBrushOtherExtent(
976
+ xyIndex, controller._transform
977
+ );
1018
978
  }
1019
979
  else {
1020
- otherExtent = [-brushWidth / 2, brushWidth / 2];
980
+ var zr = controller._zr;
981
+ otherExtent = [0, [zr.getWidth(), zr.getHeight()][1 - xyIndex]];
1021
982
  }
1022
983
  var rectRange = [localRange, otherExtent];
1023
984
  xyIndex && rectRange.reverse();
@@ -3,6 +3,7 @@
3
3
  var zrUtil = require('zrender/lib/core/util');
4
4
  var graphic = require('../../util/graphic');
5
5
  var modelUtil = require('../../util/model');
6
+ var brushHelper = require('./brushHelper');
6
7
 
7
8
  var each = zrUtil.each;
8
9
  var indexOf = zrUtil.indexOf;
@@ -168,12 +169,17 @@
168
169
  }, this);
169
170
  };
170
171
 
171
- proto.makePanelOpts = function (getDefaultBrushType) {
172
+ proto.makePanelOpts = function (api, getDefaultBrushType) {
172
173
  return zrUtil.map(this._targetInfoList, function (targetInfo) {
174
+ var rect = targetInfo.getPanelRect();
173
175
  return {
174
176
  panelId: targetInfo.panelId,
175
- rect: targetInfo.getPanelRect(),
176
- defaultBrushType: getDefaultBrushType && getDefaultBrushType(targetInfo)
177
+ defaultBrushType: getDefaultBrushType && getDefaultBrushType(targetInfo),
178
+ clipPath: brushHelper.makeRectPanelClipPath(rect),
179
+ isTargetByCursor: brushHelper.makeRectIsTargetByCursor(
180
+ rect, api, targetInfo.coordSysModel
181
+ ),
182
+ getLinearBrushOtherExtent: brushHelper.makeLinearBrushOtherExtent(rect)
177
183
  };
178
184
  });
179
185
  };
@@ -238,7 +244,7 @@
238
244
  var yAxisModels = foundCpts.yAxisModels;
239
245
  var gridModels = foundCpts.gridModels;
240
246
  // Remove duplicated.
241
- var gridModelMap = {};
247
+ var gridModelMap = zrUtil.createHashMap();
242
248
  var xAxesHas = {};
243
249
  var yAxesHas = {};
244
250
 
@@ -248,21 +254,21 @@
248
254
 
249
255
  each(xAxisModels, function (axisModel) {
250
256
  var gridModel = axisModel.axis.grid.model;
251
- gridModelMap[gridModel.id] = gridModel;
257
+ gridModelMap.set(gridModel.id, gridModel);
252
258
  xAxesHas[gridModel.id] = true;
253
259
  });
254
260
  each(yAxisModels, function (axisModel) {
255
261
  var gridModel = axisModel.axis.grid.model;
256
- gridModelMap[gridModel.id] = gridModel;
262
+ gridModelMap.set(gridModel.id, gridModel);
257
263
  yAxesHas[gridModel.id] = true;
258
264
  });
259
265
  each(gridModels, function (gridModel) {
260
- gridModelMap[gridModel.id] = gridModel;
266
+ gridModelMap.set(gridModel.id, gridModel);
261
267
  xAxesHas[gridModel.id] = true;
262
268
  yAxesHas[gridModel.id] = true;
263
269
  });
264
270
 
265
- each(gridModelMap, function (gridModel) {
271
+ gridModelMap.each(function (gridModel) {
266
272
  var grid = gridModel.coordinateSystem;
267
273
  var cartesians = [];
268
274
 
@@ -276,6 +282,7 @@
276
282
  targetInfoList.push({
277
283
  panelId: 'grid--' + gridModel.id,
278
284
  gridModel: gridModel,
285
+ coordSysModel: gridModel,
279
286
  // Use the first one as the representitive coordSys.
280
287
  coordSys: cartesians[0],
281
288
  coordSyses: cartesians,
@@ -292,6 +299,7 @@
292
299
  targetInfoList.push({
293
300
  panelId: 'geo--' + geoModel.id,
294
301
  geoModel: geoModel,
302
+ coordSysModel: geoModel,
295
303
  coordSys: coordSys,
296
304
  coordSyses: [coordSys],
297
305
  getPanelRect: panelRectBuilder.geo
@@ -4,6 +4,8 @@
4
4
 
5
5
 
6
6
  var RoamController = require('./RoamController');
7
+ var roamHelper = require('../../component/helper/roamHelper');
8
+ var cursorHelper = require('../../component/helper/cursorHelper');
7
9
  var graphic = require('../../util/graphic');
8
10
  var zrUtil = require('zrender/lib/core/util');
9
11
 
@@ -84,9 +86,13 @@
84
86
  * @type {module:echarts/component/helper/RoamController}
85
87
  * @private
86
88
  */
87
- this._controller = new RoamController(
88
- api.getZr(), updateGroup ? group : null, null
89
- );
89
+ this._controller = new RoamController(api.getZr());
90
+
91
+ /**
92
+ * @type {Object} {target, zoom, zoomLimit}
93
+ * @private
94
+ */
95
+ this._controllerHost = {target: updateGroup ? group : null};
90
96
 
91
97
  /**
92
98
  * @type {module:zrender/container/Group}
@@ -150,7 +156,7 @@
150
156
  var hoverItemStyleAccessPath = ['itemStyle', 'emphasis'];
151
157
  var labelAccessPath = ['label', 'normal'];
152
158
  var hoverLabelAccessPath = ['label', 'emphasis'];
153
- var nameMap = {};
159
+ var nameMap = zrUtil.createHashMap();
154
160
 
155
161
  zrUtil.each(geo.regions, function (region) {
156
162
 
@@ -159,8 +165,8 @@
159
165
  // colonies). And it is not appropriate to merge them in geo, which
160
166
  // will make them share the same label and bring trouble in label
161
167
  // location calculation.
162
- var regionGroup = nameMap[region.name]
163
- || (nameMap[region.name] = new graphic.Group());
168
+ var regionGroup = nameMap.get(region.name)
169
+ || nameMap.set(region.name, new graphic.Group());
164
170
 
165
171
  var compoundPath = new graphic.CompoundPath({
166
172
  shape: {
@@ -295,14 +301,17 @@
295
301
  remove: function () {
296
302
  this.group.removeAll();
297
303
  this._controller.dispose();
304
+ this._controllerHost = {};
298
305
  },
299
306
 
300
307
  _updateController: function (mapOrGeoModel, ecModel, api) {
301
308
  var geo = mapOrGeoModel.coordinateSystem;
302
309
  var controller = this._controller;
303
- controller.zoomLimit = mapOrGeoModel.get('scaleLimit');
304
- // Update zoom from model
305
- controller.zoom = geo.getZoom();
310
+ var controllerHost = this._controllerHost;
311
+
312
+ controllerHost.zoomLimit = mapOrGeoModel.get('scaleLimit');
313
+ controllerHost.zoom = geo.getZoom();
314
+
306
315
  // roamType is will be set default true if it is null
307
316
  controller.enable(mapOrGeoModel.get('roam') || false);
308
317
  var mainType = mapOrGeoModel.mainType;
@@ -319,6 +328,8 @@
319
328
  controller.off('pan').on('pan', function (dx, dy) {
320
329
  this._mouseDownFlag = false;
321
330
 
331
+ roamHelper.updateViewOnPan(controllerHost, dx, dy);
332
+
322
333
  api.dispatchAction(zrUtil.extend(makeActionBase(), {
323
334
  dx: dx,
324
335
  dy: dy
@@ -328,6 +339,8 @@
328
339
  controller.off('zoom').on('zoom', function (zoom, mouseX, mouseY) {
329
340
  this._mouseDownFlag = false;
330
341
 
342
+ roamHelper.updateViewOnZoom(controllerHost, zoom, mouseX, mouseY);
343
+
331
344
  api.dispatchAction(zrUtil.extend(makeActionBase(), {
332
345
  zoom: zoom,
333
346
  originX: mouseX,
@@ -345,8 +358,9 @@
345
358
  }
346
359
  }, this);
347
360
 
348
- controller.setContainsPoint(function (x, y) {
349
- return geo.getViewRectAfterRoam().contain(x, y);
361
+ controller.setPointerChecker(function (e, x, y) {
362
+ return geo.getViewRectAfterRoam().contain(x, y)
363
+ && !cursorHelper.onIrrelevantElement(e, api, mapOrGeoModel);
350
364
  });
351
365
  }
352
366
  };