diff --git a/plugins/tool.highlightSubgraph/index.js b/plugins/tool.highlightSubgraph/index.js index ddc1a63ef7..f563e1d581 100644 --- a/plugins/tool.highlightSubgraph/index.js +++ b/plugins/tool.highlightSubgraph/index.js @@ -40,7 +40,8 @@ G6.registerGuide('mask', { capture: false }); }, - bboxCalculation: false + bboxCalculation: false, + filter: false }); class Plugin { diff --git a/src/mixin/filter.js b/src/mixin/filter.js index ab6022cf38..7ec375ef9a 100755 --- a/src/mixin/filter.js +++ b/src/mixin/filter.js @@ -49,9 +49,9 @@ Mixin.AUGMENT = { this.emit('beforefilter'); const filters = this.get('filters'); const items = this.getItems(); - let filteredItems = this.getItems(); + let filteredItems = this._getFilterItems(); filters.forEach(filter => { - filteredItems = Util.filter(filteredItems, filter); + filteredItems = filteredItems.filter(filter); }); items.forEach(item => { if (filteredItems.indexOf(item) === -1) { @@ -60,8 +60,20 @@ Mixin.AUGMENT = { item.show(); } }); + this.draw(); this.emit('afterfilter'); + }, + /** + * get filter items + * @return {array} filterItems + */ + _getFilterItems() { + const items = this.getItems(); + return items.filter(item => { + const shapeObj = item.getShapeObj(); + return shapeObj.filter !== false; + }); } }; module.exports = Mixin;