|
@@ -1,107 +1,108 @@
|
1
|
|
-/* eslint-disable */
|
2
|
|
-// import * as echarts from '../../node_modules/echarts'
|
3
|
|
-var echarts = require('../../node_modules/echarts')
|
4
|
|
-// import * as zrUtil from '../../node_modules/zrender/src/core/util'
|
5
|
|
-var zrUtil = require('../../node_modules/zrender/src/core/util')
|
6
|
|
-var BrushController = require('./BrushController')
|
7
|
|
-
|
8
|
|
-/*
|
9
|
|
-* Licensed to the Apache Software Foundation (ASF) under one
|
10
|
|
-* or more contributor license agreements. See the NOTICE file
|
11
|
|
-* distributed with this work for additional information
|
12
|
|
-* regarding copyright ownership. The ASF licenses this file
|
13
|
|
-* to you under the Apache License, Version 2.0 (the
|
14
|
|
-* "License"); you may not use this file except in compliance
|
15
|
|
-* with the License. You may obtain a copy of the License at
|
16
|
|
-*
|
17
|
|
-* http://www.apache.org/licenses/LICENSE-2.0
|
18
|
|
-*
|
19
|
|
-* Unless required by applicable law or agreed to in writing,
|
20
|
|
-* software distributed under the License is distributed on an
|
21
|
|
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
22
|
|
-* KIND, either express or implied. See the License for the
|
23
|
|
-* specific language governing permissions and limitations
|
24
|
|
-* under the License.
|
25
|
|
-*/
|
26
|
|
-var _default = echarts.extendComponentView({
|
27
|
|
- type: 'brush',
|
28
|
|
- init: function (ecModel, api) {
|
29
|
|
- /**
|
30
|
|
- * @readOnly
|
31
|
|
- * @type {module:echarts/model/Global}
|
32
|
|
- */
|
33
|
|
- this.ecModel = ecModel
|
34
|
|
- /**
|
35
|
|
- * @readOnly
|
36
|
|
- * @type {module:echarts/ExtensionAPI}
|
37
|
|
- */
|
38
|
|
- this.api = api
|
39
|
|
- /**
|
40
|
|
- * @readOnly
|
41
|
|
- * @type {module:echarts/component/brush/BrushModel}
|
42
|
|
- */
|
43
|
|
- this.model
|
44
|
|
- /**
|
45
|
|
- * @private
|
46
|
|
- * @type {module:echarts/component/helper/BrushController}
|
47
|
|
- */
|
48
|
|
- (this._brushController = new BrushController(api.getZr())).on('brush', zrUtil.bind(this._onBrush, this)).mount()
|
49
|
|
- },
|
50
|
|
-
|
51
|
|
- /**
|
52
|
|
- * @override
|
53
|
|
- */
|
54
|
|
- render: function (brushModel) {
|
55
|
|
- this.model = brushModel
|
56
|
|
- return updateController.apply(this, arguments)
|
57
|
|
- },
|
58
|
|
-
|
59
|
|
- /**
|
60
|
|
- * @override
|
61
|
|
- */
|
62
|
|
- updateTransform: updateController,
|
63
|
|
-
|
64
|
|
- /**
|
65
|
|
- * @override
|
66
|
|
- */
|
67
|
|
- updateView: updateController,
|
68
|
|
- // /**
|
69
|
|
- // * @override
|
70
|
|
- // */
|
71
|
|
- // updateLayout: updateController,
|
72
|
|
- // /**
|
73
|
|
- // * @override
|
74
|
|
- // */
|
75
|
|
- // updateVisual: updateController,
|
76
|
|
-
|
77
|
|
- /**
|
78
|
|
- * @override
|
79
|
|
- */
|
80
|
|
- dispose: function () {
|
81
|
|
- this._brushController.dispose()
|
82
|
|
- },
|
83
|
|
-
|
84
|
|
- /**
|
85
|
|
- * @private
|
86
|
|
- */
|
87
|
|
- _onBrush: function (areas, opt) {
|
88
|
|
- var modelId = this.model.id
|
89
|
|
- this.model.brushTargetManager.setOutputRanges(areas, this.ecModel) // Action is not dispatched on drag end, because the drag end
|
90
|
|
- // emits the same params with the last drag move event, and
|
91
|
|
- // may have some delay when using touch pad, which makes
|
92
|
|
- // animation not smooth (when using debounce).
|
93
|
|
- (!opt.isEnd || opt.removeOnClick) && this.api.dispatchAction({
|
94
|
|
- type: 'brush',
|
95
|
|
- brushId: modelId,
|
96
|
|
- areas: zrUtil.clone(areas),
|
97
|
|
- $from: modelId
|
98
|
|
- })
|
99
|
|
- }
|
100
|
|
-})
|
101
|
|
-
|
102
|
|
-function updateController (brushModel, ecModel, api, payload) {
|
103
|
|
- // Do not update controller when drawing.
|
104
|
|
- // (!payload || payload.$from !== brushModel.id) && this._brushController.setPanels(brushModel.brushTargetManager.makePanelOpts(api)).enableBrush(brushModel.brushOption).updateCovers(brushModel.areas.slice())
|
105
|
|
-}
|
106
|
|
-
|
107
|
|
-module.exports = _default
|
|
1
|
+/* eslint-disable */
|
|
2
|
+// import * as echarts from '../../node_modules/echarts'
|
|
3
|
+var echarts = require('../../node_modules/echarts/lib/echarts')
|
|
4
|
+// import * as zrUtil from '../../node_modules/zrender/src/core/util'
|
|
5
|
+var zrUtil = require('zrender/src/core/util')
|
|
6
|
+var BrushController = require('./BrushController')
|
|
7
|
+
|
|
8
|
+/*
|
|
9
|
+* Licensed to the Apache Software Foundation (ASF) under one
|
|
10
|
+* or more contributor license agreements. See the NOTICE file
|
|
11
|
+* distributed with this work for additional information
|
|
12
|
+* regarding copyright ownership. The ASF licenses this file
|
|
13
|
+* to you under the Apache License, Version 2.0 (the
|
|
14
|
+* "License"); you may not use this file except in compliance
|
|
15
|
+* with the License. You may obtain a copy of the License at
|
|
16
|
+*
|
|
17
|
+* http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+*
|
|
19
|
+* Unless required by applicable law or agreed to in writing,
|
|
20
|
+* software distributed under the License is distributed on an
|
|
21
|
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
22
|
+* KIND, either express or implied. See the License for the
|
|
23
|
+* specific language governing permissions and limitations
|
|
24
|
+* under the License.
|
|
25
|
+*/
|
|
26
|
+var _default = echarts.extendComponentView({
|
|
27
|
+ type: 'brush',
|
|
28
|
+ init: function (ecModel, api) {
|
|
29
|
+ /**
|
|
30
|
+ * @readOnly
|
|
31
|
+ * @type {module:echarts/model/Global}
|
|
32
|
+ */
|
|
33
|
+ this.ecModel = ecModel
|
|
34
|
+ /**
|
|
35
|
+ * @readOnly
|
|
36
|
+ * @type {module:echarts/ExtensionAPI}
|
|
37
|
+ */
|
|
38
|
+ this.api = api
|
|
39
|
+ /**
|
|
40
|
+ * @readOnly
|
|
41
|
+ * @type {module:echarts/component/brush/BrushModel}
|
|
42
|
+ */
|
|
43
|
+ this.model;
|
|
44
|
+ /**
|
|
45
|
+ * @private
|
|
46
|
+ * @type {module:echarts/component/helper/BrushController}
|
|
47
|
+ */
|
|
48
|
+ (this._brushController = new BrushController(api.getZr())).on('brush', zrUtil.bind(this._onBrush, this)).mount()
|
|
49
|
+ },
|
|
50
|
+
|
|
51
|
+ /**
|
|
52
|
+ * @override
|
|
53
|
+ */
|
|
54
|
+ render: function (brushModel) {
|
|
55
|
+ // console.log(brushModel)
|
|
56
|
+ this.model = brushModel
|
|
57
|
+ return updateController.apply(this, arguments)
|
|
58
|
+ },
|
|
59
|
+
|
|
60
|
+ /**
|
|
61
|
+ * @override
|
|
62
|
+ */
|
|
63
|
+ updateTransform: updateController,
|
|
64
|
+
|
|
65
|
+ /**
|
|
66
|
+ * @override
|
|
67
|
+ */
|
|
68
|
+ updateView: updateController,
|
|
69
|
+ // /**
|
|
70
|
+ // * @override
|
|
71
|
+ // */
|
|
72
|
+ // updateLayout: updateController,
|
|
73
|
+ // /**
|
|
74
|
+ // * @override
|
|
75
|
+ // */
|
|
76
|
+ // updateVisual: updateController,
|
|
77
|
+
|
|
78
|
+ /**
|
|
79
|
+ * @override
|
|
80
|
+ */
|
|
81
|
+ dispose: function () {
|
|
82
|
+ this._brushController.dispose()
|
|
83
|
+ },
|
|
84
|
+
|
|
85
|
+ /**
|
|
86
|
+ * @private
|
|
87
|
+ */
|
|
88
|
+ _onBrush: function (areas, opt) {
|
|
89
|
+ var modelId = this.model.id
|
|
90
|
+ this.model.brushTargetManager.setOutputRanges(areas, this.ecModel); // Action is not dispatched on drag end, because the drag end
|
|
91
|
+ // emits the same params with the last drag move event, and
|
|
92
|
+ // may have some delay when using touch pad, which makes
|
|
93
|
+ // animation not smooth (when using debounce).
|
|
94
|
+ (!opt.isEnd || opt.removeOnClick) && this.api.dispatchAction({
|
|
95
|
+ type: 'brush',
|
|
96
|
+ brushId: modelId,
|
|
97
|
+ areas: zrUtil.clone(areas),
|
|
98
|
+ $from: modelId
|
|
99
|
+ })
|
|
100
|
+ }
|
|
101
|
+})
|
|
102
|
+
|
|
103
|
+function updateController (brushModel, ecModel, api, payload) {
|
|
104
|
+ // Do not update controller when drawing.
|
|
105
|
+ (!payload || payload.$from !== brushModel.id) && this._brushController.setPanels(brushModel.brushTargetManager.makePanelOpts(api)).enableBrush(brushModel.brushOption).updateCovers(brushModel.areas.slice())
|
|
106
|
+}
|
|
107
|
+
|
|
108
|
+module.exports = _default
|