123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- var echarts = require("../../echarts");
- var zrUtil = require("zrender/lib/core/util");
- var BrushController = require("../helper/BrushController");
- var _visualEncoding = require("./visualEncoding");
- var layoutCovers = _visualEncoding.layoutCovers;
- var _default = echarts.extendComponentView({
- type: 'brush',
- init: function (ecModel, api) {
-
- this.ecModel = ecModel;
-
- this.api = api;
-
- this.model;
-
- (this._brushController = new BrushController(api.getZr())).on('brush', zrUtil.bind(this._onBrush, this)).mount();
- },
-
- render: function (brushModel) {
- this.model = brushModel;
- return updateController.apply(this, arguments);
- },
-
- updateTransform: function (brushModel, ecModel) {
-
-
-
- layoutCovers(ecModel);
- return updateController.apply(this, arguments);
- },
-
- updateView: updateController,
-
-
-
-
-
-
-
-
-
- dispose: function () {
- this._brushController.dispose();
- },
-
- _onBrush: function (areas, opt) {
- var modelId = this.model.id;
- this.model.brushTargetManager.setOutputRanges(areas, this.ecModel);
-
-
-
- (!opt.isEnd || opt.removeOnClick) && this.api.dispatchAction({
- type: 'brush',
- brushId: modelId,
- areas: zrUtil.clone(areas),
- $from: modelId
- });
- opt.isEnd && this.api.dispatchAction({
- type: 'brushEnd',
- brushId: modelId,
- areas: zrUtil.clone(areas),
- $from: modelId
- });
- }
- });
- function updateController(brushModel, ecModel, api, payload) {
-
- (!payload || payload.$from !== brushModel.id) && this._brushController.setPanels(brushModel.brushTargetManager.makePanelOpts(api)).enableBrush(brushModel.brushOption).updateCovers(brushModel.areas.slice());
- }
- module.exports = _default;
|