UNPKG

1.26 kBJavaScriptView Raw
1import { __extends } from "tslib";
2import { getElements } from '../util';
3import { clearHighlight, setHighlightBy } from './highlight-util';
4import ElementSingleState from './single-state';
5/**
6 * @ignore
7 * 单个 Element Highlight 的 Action
8 */
9var ElementSingleHighlight = /** @class */ (function (_super) {
10 __extends(ElementSingleHighlight, _super);
11 function ElementSingleHighlight() {
12 var _this = _super !== null && _super.apply(this, arguments) || this;
13 _this.stateName = 'active';
14 return _this;
15 }
16 /**
17 * Element Highlight
18 */
19 ElementSingleHighlight.prototype.highlight = function () {
20 this.setState();
21 };
22 ElementSingleHighlight.prototype.setElementState = function (element, enable) {
23 var view = this.context.view;
24 var elements = getElements(view);
25 setHighlightBy(elements, function (el) { return element === el; }, enable);
26 };
27 // 清理掉所有的 active, unactive 状态
28 ElementSingleHighlight.prototype.clear = function () {
29 var view = this.context.view;
30 clearHighlight(view);
31 };
32 return ElementSingleHighlight;
33}(ElementSingleState));
34export default ElementSingleHighlight;
35//# sourceMappingURL=single-highlight.js.map
\No newline at end of file