mirror of
https://gitee.com/antv/g6.git
synced 2024-11-29 18:28:19 +08:00
feat: _getFilterItems
This commit is contained in:
parent
4782b06a03
commit
8e4ff4c1e6
@ -40,7 +40,8 @@ G6.registerGuide('mask', {
|
||||
capture: false
|
||||
});
|
||||
},
|
||||
bboxCalculation: false
|
||||
bboxCalculation: false,
|
||||
filter: false
|
||||
});
|
||||
|
||||
class Plugin {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user