cione-comp-lib
Version:
`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`
70 lines (69 loc) • 2.33 kB
JavaScript
import { __extends } from "../../../../tslib/tslib.es6.mjs";
import { map, merge } from "../../../../zrender/lib/core/util.mjs";
import { replaceVisualOption } from "../../visual/visualSolution.mjs";
import Model from "../../model/Model.mjs";
import ComponentModel from "../../model/Component.mjs";
var DEFAULT_OUT_OF_BRUSH_COLOR = "#ddd";
var BrushModel = function(_super) {
__extends(BrushModel2, _super);
function BrushModel2() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.type = BrushModel2.type;
_this.areas = [];
_this.brushOption = {};
return _this;
}
BrushModel2.prototype.optionUpdated = function(newOption, isInit) {
var thisOption = this.option;
!isInit && replaceVisualOption(thisOption, newOption, ["inBrush", "outOfBrush"]);
var inBrush = thisOption.inBrush = thisOption.inBrush || {};
thisOption.outOfBrush = thisOption.outOfBrush || {
color: DEFAULT_OUT_OF_BRUSH_COLOR
};
if (!inBrush.hasOwnProperty("liftZ")) {
inBrush.liftZ = 5;
}
};
BrushModel2.prototype.setAreas = function(areas) {
if (!areas) {
return;
}
this.areas = map(areas, function(area) {
return generateBrushOption(this.option, area);
}, this);
};
BrushModel2.prototype.setBrushOption = function(brushOption) {
this.brushOption = generateBrushOption(this.option, brushOption);
this.brushType = this.brushOption.brushType;
};
BrushModel2.type = "brush";
BrushModel2.dependencies = ["geo", "grid", "xAxis", "yAxis", "parallel", "series"];
BrushModel2.defaultOption = {
seriesIndex: "all",
brushType: "rect",
brushMode: "single",
transformable: true,
brushStyle: {
borderWidth: 1,
color: "rgba(210,219,238,0.3)",
borderColor: "#D2DBEE"
},
throttleType: "fixRate",
throttleDelay: 0,
removeOnClick: true,
z: 1e4
};
return BrushModel2;
}(ComponentModel);
function generateBrushOption(option, brushOption) {
return merge({
brushType: option.brushType,
brushMode: option.brushMode,
transformable: option.transformable,
brushStyle: new Model(option.brushStyle).getItemStyle(),
removeOnClick: option.removeOnClick,
z: option.z
}, brushOption, true);
}
var BrushModel$1 = BrushModel;
export { BrushModel$1 as default };