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.
- package/LICENSE +21 -18
- package/README.md +10 -0
- package/dist/echarts.common.js +11010 -9830
- package/dist/echarts.common.min.js +13 -13
- package/dist/echarts.js +13291 -10852
- package/dist/echarts.min.js +22 -21
- package/dist/echarts.simple.js +9904 -8990
- package/dist/echarts.simple.min.js +9 -10
- package/index.js +1 -0
- package/lib/ExtensionAPI.js +2 -4
- package/lib/chart/bar/BarView.js +141 -49
- package/lib/chart/bar/BaseBarSeries.js +2 -6
- package/lib/chart/bar.js +1 -0
- package/lib/chart/boxplot/BoxplotSeries.js +1 -1
- package/lib/chart/boxplot/boxplotLayout.js +23 -7
- package/lib/chart/candlestick/CandlestickSeries.js +3 -22
- package/lib/chart/candlestick/candlestickLayout.js +23 -7
- package/lib/chart/custom.js +442 -0
- package/lib/chart/funnel/funnelLayout.js +10 -3
- package/lib/chart/gauge/GaugeView.js +1 -1
- package/lib/chart/graph/GraphView.js +15 -9
- package/lib/chart/graph/categoryVisual.js +3 -2
- package/lib/chart/heatmap/HeatmapLayer.js +1 -1
- package/lib/chart/heatmap/HeatmapView.js +75 -73
- package/lib/chart/helper/Symbol.js +8 -31
- package/lib/chart/helper/createListFromArray.js +15 -10
- package/lib/chart/helper/labelHelper.js +48 -0
- package/lib/chart/helper/whiskerBoxCommon.js +25 -44
- package/lib/chart/map/mapDataStatistic.js +9 -8
- package/lib/chart/parallel/ParallelSeries.js +2 -0
- package/lib/chart/parallel/ParallelView.js +13 -12
- package/lib/chart/parallel/parallelVisual.js +9 -1
- package/lib/chart/pie/pieLayout.js +25 -17
- package/lib/chart/radar/RadarSeries.js +1 -1
- package/lib/chart/sankey/sankeyLayout.js +1 -1
- package/lib/chart/scatter/ScatterSeries.js +2 -3
- package/lib/chart/themeRiver/ThemeRiverSeries.js +6 -5
- package/lib/chart/themeRiver/themeRiverVisual.js +1 -1
- package/lib/chart/treemap/TreemapSeries.js +3 -3
- package/lib/chart/treemap/TreemapView.js +1 -1
- package/lib/chart/treemap/treemapLayout.js +6 -1
- package/lib/component/axis/AxisBuilder.js +53 -34
- package/lib/component/axis/ParallelAxisView.js +45 -37
- package/lib/component/axisPointer/AxisPointerModel.js +1 -1
- package/lib/component/axisPointer/BaseAxisPointer.js +20 -15
- package/lib/component/axisPointer/CartesianAxisPointer.js +9 -6
- package/lib/component/axisPointer/PolarAxisPointer.js +10 -8
- package/lib/component/axisPointer/SingleAxisPointer.js +11 -7
- package/lib/component/axisPointer/axisTrigger.js +87 -72
- package/lib/component/axisPointer/viewHelper.js +6 -3
- package/lib/component/axisPointer.js +2 -2
- package/lib/component/brush/BrushModel.js +6 -4
- package/lib/component/brush/BrushView.js +1 -1
- package/lib/component/brush/visualEncoding.js +6 -4
- package/lib/component/calendar/CalendarView.js +5 -5
- package/lib/component/dataZoom/AxisProxy.js +76 -13
- package/lib/component/dataZoom/DataZoomModel.js +21 -5
- package/lib/component/dataZoom/InsideZoomModel.js +4 -1
- package/lib/component/dataZoom/InsideZoomView.js +17 -27
- package/lib/component/dataZoom/SliderZoomView.js +63 -26
- package/lib/component/dataZoom/roams.js +9 -4
- package/lib/component/graphic.js +13 -12
- package/lib/component/helper/BrushController.js +75 -114
- package/lib/component/helper/BrushTargetManager.js +16 -8
- package/lib/component/helper/MapDraw.js +25 -11
- package/lib/component/helper/RoamController.js +111 -139
- package/lib/component/helper/brushHelper.js +25 -213
- package/lib/component/helper/cursorHelper.js +21 -0
- package/lib/component/helper/roamHelper.js +54 -0
- package/lib/component/helper/selectableMixin.js +7 -7
- package/lib/component/helper/sliderMove.js +66 -37
- package/lib/component/legend/LegendView.js +6 -6
- package/lib/component/legend/legendAction.js +1 -1
- package/lib/component/marker/MarkAreaView.js +3 -6
- package/lib/component/marker/MarkLineView.js +3 -5
- package/lib/component/marker/MarkPointView.js +3 -5
- package/lib/component/marker/MarkerView.js +10 -12
- package/lib/component/marker/markerHelper.js +1 -1
- package/lib/component/parallel.js +94 -29
- package/lib/component/polar.js +5 -0
- package/lib/component/timeline/SliderTimelineView.js +1 -1
- package/lib/component/toolbox/feature/Brush.js +7 -0
- package/lib/component/toolbox/feature/DataZoom.js +17 -4
- package/lib/component/tooltip/TooltipView.js +92 -20
- package/lib/component/visualMap/ContinuousView.js +6 -4
- package/lib/coord/Axis.js +34 -2
- package/lib/coord/axisDefault.js +4 -1
- package/lib/coord/axisHelper.js +32 -26
- package/lib/coord/axisModelCommonMixin.js +1 -1
- package/lib/coord/calendar/Calendar.js +14 -17
- package/lib/coord/calendar/prepareCustom.js +31 -0
- package/lib/coord/cartesian/Axis2D.js +0 -12
- package/lib/coord/cartesian/Cartesian2D.js +1 -0
- package/lib/coord/cartesian/Grid.js +5 -2
- package/lib/coord/cartesian/prepareCustom.js +36 -0
- package/lib/coord/geo/Geo.js +9 -14
- package/lib/coord/geo/GeoModel.js +5 -5
- package/lib/coord/geo/geoCreator.js +3 -3
- package/lib/coord/geo/parseGeoJson.js +11 -4
- package/lib/coord/geo/prepareCustom.js +36 -0
- package/lib/coord/parallel/Parallel.js +225 -101
- package/lib/coord/parallel/ParallelModel.js +7 -1
- package/lib/coord/polar/Polar.js +2 -1
- package/lib/coord/polar/prepareCustom.js +53 -0
- package/lib/coord/single/Single.js +9 -8
- package/lib/coord/single/SingleAxis.js +0 -27
- package/lib/coord/single/prepareCustom.js +33 -0
- package/lib/data/DataDiffer.js +2 -1
- package/lib/data/Graph.js +11 -7
- package/lib/data/List.js +59 -20
- package/lib/data/helper/completeDimensions.js +184 -23
- package/lib/echarts.js +68 -36
- package/lib/helper.js +1 -8
- package/lib/layout/barGrid.js +91 -19
- package/lib/layout/barPolar.js +286 -0
- package/lib/layout/points.js +22 -16
- package/lib/model/Global.js +34 -31
- package/lib/model/Series.js +41 -29
- package/lib/model/globalDefault.js +4 -1
- package/lib/model/mixin/colorPalette.js +2 -1
- package/lib/model/mixin/textStyle.js +7 -13
- package/lib/scale/Interval.js +46 -76
- package/lib/scale/Log.js +5 -7
- package/lib/scale/Scale.js +10 -1
- package/lib/scale/Time.js +34 -12
- package/lib/scale/helper.js +93 -0
- package/lib/util/format.js +20 -9
- package/lib/util/graphic.js +70 -8
- package/lib/util/layout.js +7 -3
- package/lib/util/model.js +63 -7
- package/lib/util/number.js +59 -19
- package/lib/util/throttle.js +14 -3
- package/map/js/world.js +1 -1
- package/map/json/world.json +1 -1
- package/package.json +3 -3
- package/src/ExtensionAPI.js +2 -4
- package/src/chart/bar/BarView.js +141 -49
- package/src/chart/bar/BaseBarSeries.js +2 -6
- package/src/chart/bar.js +1 -0
- package/src/chart/boxplot/BoxplotSeries.js +1 -1
- package/src/chart/boxplot/boxplotLayout.js +23 -7
- package/src/chart/candlestick/CandlestickSeries.js +3 -22
- package/src/chart/candlestick/candlestickLayout.js +23 -7
- package/src/chart/custom.js +442 -0
- package/src/chart/funnel/funnelLayout.js +10 -4
- package/src/chart/gauge/GaugeView.js +1 -1
- package/src/chart/graph/GraphView.js +15 -9
- package/src/chart/graph/categoryVisual.js +3 -2
- package/src/chart/heatmap/HeatmapLayer.js +1 -1
- package/src/chart/heatmap/HeatmapView.js +75 -73
- package/src/chart/helper/Symbol.js +8 -31
- package/src/chart/helper/createListFromArray.js +15 -10
- package/src/chart/helper/labelHelper.js +49 -0
- package/src/chart/helper/whiskerBoxCommon.js +25 -44
- package/src/chart/map/mapDataStatistic.js +9 -8
- package/src/chart/parallel/ParallelSeries.js +2 -0
- package/src/chart/parallel/ParallelView.js +13 -12
- package/src/chart/parallel/parallelVisual.js +9 -1
- package/src/chart/pie/pieLayout.js +25 -17
- package/src/chart/radar/RadarSeries.js +1 -1
- package/src/chart/sankey/sankeyLayout.js +1 -1
- package/src/chart/scatter/ScatterSeries.js +2 -3
- package/src/chart/themeRiver/ThemeRiverSeries.js +6 -5
- package/src/chart/themeRiver/themeRiverVisual.js +1 -1
- package/src/chart/treemap/TreemapSeries.js +3 -3
- package/src/chart/treemap/TreemapView.js +1 -1
- package/src/chart/treemap/treemapLayout.js +6 -1
- package/src/component/axis/AxisBuilder.js +53 -34
- package/src/component/axis/ParallelAxisView.js +45 -37
- package/src/component/axisPointer/AxisPointerModel.js +1 -1
- package/src/component/axisPointer/BaseAxisPointer.js +20 -15
- package/src/component/axisPointer/CartesianAxisPointer.js +9 -6
- package/src/component/axisPointer/PolarAxisPointer.js +10 -8
- package/src/component/axisPointer/SingleAxisPointer.js +11 -7
- package/src/component/axisPointer/axisTrigger.js +87 -72
- package/src/component/axisPointer/viewHelper.js +6 -3
- package/src/component/axisPointer.js +2 -2
- package/src/component/brush/BrushModel.js +6 -4
- package/src/component/brush/BrushView.js +1 -1
- package/src/component/brush/visualEncoding.js +6 -4
- package/src/component/calendar/CalendarView.js +5 -5
- package/src/component/dataZoom/AxisProxy.js +76 -13
- package/src/component/dataZoom/DataZoomModel.js +21 -5
- package/src/component/dataZoom/InsideZoomModel.js +4 -1
- package/src/component/dataZoom/InsideZoomView.js +17 -27
- package/src/component/dataZoom/SliderZoomView.js +63 -26
- package/src/component/dataZoom/roams.js +9 -4
- package/src/component/graphic.js +13 -12
- package/src/component/helper/BrushController.js +75 -114
- package/src/component/helper/BrushTargetManager.js +16 -8
- package/src/component/helper/MapDraw.js +25 -11
- package/src/component/helper/RoamController.js +111 -139
- package/src/component/helper/brushHelper.js +41 -0
- package/src/component/helper/cursorHelper.js +22 -0
- package/src/component/helper/roamHelper.js +55 -0
- package/src/component/helper/selectableMixin.js +7 -7
- package/src/component/helper/sliderMove.js +66 -37
- package/src/component/legend/LegendView.js +6 -6
- package/src/component/legend/legendAction.js +1 -1
- package/src/component/marker/MarkAreaView.js +3 -6
- package/src/component/marker/MarkLineView.js +3 -5
- package/src/component/marker/MarkPointView.js +3 -5
- package/src/component/marker/MarkerView.js +10 -12
- package/src/component/marker/markerHelper.js +1 -1
- package/src/component/parallel.js +94 -29
- package/src/component/polar.js +5 -0
- package/src/component/timeline/SliderTimelineView.js +1 -1
- package/src/component/toolbox/feature/Brush.js +7 -0
- package/src/component/toolbox/feature/DataZoom.js +17 -4
- package/src/component/tooltip/TooltipView.js +92 -20
- package/src/component/visualMap/ContinuousView.js +6 -4
- package/src/coord/Axis.js +34 -2
- package/src/coord/axisDefault.js +4 -1
- package/src/coord/axisHelper.js +32 -26
- package/src/coord/axisModelCommonMixin.js +1 -1
- package/src/coord/calendar/Calendar.js +14 -17
- package/src/coord/calendar/prepareCustom.js +32 -0
- package/src/coord/cartesian/Axis2D.js +0 -12
- package/src/coord/cartesian/Cartesian2D.js +1 -0
- package/src/coord/cartesian/Grid.js +5 -2
- package/src/coord/cartesian/prepareCustom.js +37 -0
- package/src/coord/geo/Geo.js +9 -14
- package/src/coord/geo/GeoModel.js +5 -5
- package/src/coord/geo/geoCreator.js +3 -3
- package/src/coord/geo/parseGeoJson.js +11 -4
- package/src/coord/geo/prepareCustom.js +37 -0
- package/src/coord/parallel/Parallel.js +225 -101
- package/src/coord/parallel/ParallelModel.js +7 -1
- package/src/coord/polar/Polar.js +2 -1
- package/src/coord/polar/prepareCustom.js +54 -0
- package/src/coord/single/Single.js +9 -8
- package/src/coord/single/SingleAxis.js +0 -27
- package/src/coord/single/prepareCustom.js +34 -0
- package/src/data/DataDiffer.js +2 -1
- package/src/data/Graph.js +11 -7
- package/src/data/List.js +59 -20
- package/src/data/helper/completeDimensions.js +184 -23
- package/src/echarts.js +68 -36
- package/src/helper.js +1 -8
- package/src/layout/barGrid.js +91 -19
- package/src/layout/barPolar.js +287 -0
- package/src/layout/points.js +22 -16
- package/src/model/Global.js +34 -31
- package/src/model/Series.js +41 -29
- package/src/model/globalDefault.js +4 -1
- package/src/model/mixin/colorPalette.js +2 -1
- package/src/model/mixin/textStyle.js +7 -13
- package/src/scale/Interval.js +46 -76
- package/src/scale/Log.js +5 -7
- package/src/scale/Scale.js +10 -1
- package/src/scale/Time.js +34 -12
- package/src/scale/helper.js +94 -0
- package/src/util/format.js +20 -9
- package/src/util/graphic.js +70 -8
- package/src/util/layout.js +7 -3
- package/src/util/model.js +63 -7
- package/src/util/number.js +59 -19
- package/src/util/throttle.js +14 -3
- package/src/coord/cartesian/axisLabelInterval.js +0 -26
- package/theme/default.js +0 -23
- 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
|
-
*
|
|
213
|
-
*
|
|
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
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
|
706
|
-
|
|
707
|
-
|
|
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
|
-
|
|
732
|
-
|
|
733
|
-
|
|
699
|
+
function resetCursor(controller, e, localCursorPoint) {
|
|
700
|
+
// Check active
|
|
701
|
+
if (!controller._brushType) {
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
734
704
|
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
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
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
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(
|
|
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.
|
|
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,
|
|
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.
|
|
796
|
+
panel && panel.defaultBrushType,
|
|
831
797
|
'MUST have defaultBrushType when brushType is "atuo"'
|
|
832
798
|
);
|
|
833
799
|
}
|
|
834
|
-
return panel.
|
|
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
|
|
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,
|
|
820
|
+
var panel = this._creatingPanel = getPanelByPoint(this, e, localCursorPoint);
|
|
856
821
|
|
|
857
822
|
if (panel) {
|
|
858
823
|
this._dragging = true;
|
|
859
|
-
this._track = [
|
|
824
|
+
this._track = [localCursorPoint.slice()];
|
|
860
825
|
}
|
|
861
826
|
}
|
|
862
827
|
},
|
|
863
828
|
|
|
864
829
|
mousemove: function (e) {
|
|
865
|
-
|
|
866
|
-
|
|
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
|
|
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
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
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
|
-
|
|
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
|
-
|
|
176
|
-
|
|
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
|
|
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
|
|
262
|
+
gridModelMap.set(gridModel.id, gridModel);
|
|
257
263
|
yAxesHas[gridModel.id] = true;
|
|
258
264
|
});
|
|
259
265
|
each(gridModels, function (gridModel) {
|
|
260
|
-
gridModelMap
|
|
266
|
+
gridModelMap.set(gridModel.id, gridModel);
|
|
261
267
|
xAxesHas[gridModel.id] = true;
|
|
262
268
|
yAxesHas[gridModel.id] = true;
|
|
263
269
|
});
|
|
264
270
|
|
|
265
|
-
each(
|
|
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
|
-
|
|
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
|
|
163
|
-
|| (
|
|
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
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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.
|
|
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
|
};
|