@visactor/vgrammar-core
Version:
VGrammar is a visual grammar library
26 lines (23 loc) • 969 B
JavaScript
import { InteractionStateEnum } from "../graph/enums";
import { BrushBase } from "./brush-base";
export class BrushActive extends BrushBase {
constructor(view, option) {
super(view, Object.assign({}, BrushActive.defaultOptions, option)), this.type = BrushActive.type,
this.handleBrushUpdate = event => {
const elements = [];
this._marks.forEach((mark => {
mark.elements.forEach((el => {
this.isBrushContainGraphicItem(event.detail.operateMask, el.getGraphicItem()) ? (elements.push(el),
el.addState(this.options.state)) : el.removeState(this.options.state);
}));
})), this._dispatchEvent(event, elements);
};
}
getStartState() {
return this.options.state;
}
}
BrushActive.type = "brush-active", BrushActive.defaultOptions = {
state: InteractionStateEnum.active
};
//# sourceMappingURL=brush-active.js.map