UNPKG

cione-comp-lib

Version:

`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`

60 lines (59 loc) 2.46 kB
import { __extends } from "../../../../tslib/tslib.es6.mjs"; import { bind, clone } from "../../../../zrender/lib/core/util.mjs"; import BrushController from "../helper/BrushController.mjs"; import { layoutCovers } from "./visualEncoding.mjs"; import ComponentView from "../../view/Component.mjs"; var BrushView = function(_super) { __extends(BrushView2, _super); function BrushView2() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.type = BrushView2.type; return _this; } BrushView2.prototype.init = function(ecModel, api) { this.ecModel = ecModel; this.api = api; this.model; (this._brushController = new BrushController(api.getZr())).on("brush", bind(this._onBrush, this)).mount(); }; BrushView2.prototype.render = function(brushModel, ecModel, api, payload) { this.model = brushModel; this._updateController(brushModel, ecModel, api, payload); }; BrushView2.prototype.updateTransform = function(brushModel, ecModel, api, payload) { layoutCovers(ecModel); this._updateController(brushModel, ecModel, api, payload); }; BrushView2.prototype.updateVisual = function(brushModel, ecModel, api, payload) { this.updateTransform(brushModel, ecModel, api, payload); }; BrushView2.prototype.updateView = function(brushModel, ecModel, api, payload) { this._updateController(brushModel, ecModel, api, payload); }; BrushView2.prototype._updateController = function(brushModel, ecModel, api, payload) { (!payload || payload.$from !== brushModel.id) && this._brushController.setPanels(brushModel.brushTargetManager.makePanelOpts(api)).enableBrush(brushModel.brushOption).updateCovers(brushModel.areas.slice()); }; BrushView2.prototype.dispose = function() { this._brushController.dispose(); }; BrushView2.prototype._onBrush = function(eventParam) { var modelId = this.model.id; var areas = this.model.brushTargetManager.setOutputRanges(eventParam.areas, this.ecModel); (!eventParam.isEnd || eventParam.removeOnClick) && this.api.dispatchAction({ type: "brush", brushId: modelId, areas: clone(areas), $from: modelId }); eventParam.isEnd && this.api.dispatchAction({ type: "brushEnd", brushId: modelId, areas: clone(areas), $from: modelId }); }; BrushView2.type = "brush"; return BrushView2; }(ComponentView); var BrushView$1 = BrushView; export { BrushView$1 as default };