mirror of
https://gitee.com/antv/g6.git
synced 2024-11-29 18:28:19 +08:00
perf(runtime): optimize element perf
This commit is contained in:
parent
9d824d4991
commit
6c6f7f99ea
@ -141,11 +141,13 @@ export class ElementController {
|
||||
|
||||
private computeElementsDefaultStyle(ids?: ID[]) {
|
||||
this.forEachElementData((elementType, elementData) => {
|
||||
elementData
|
||||
.filter((datum) => ids === undefined || ids.includes(idOf(datum)))
|
||||
.forEach((datum) => {
|
||||
const length = elementData.length;
|
||||
for (let i = 0; i < length; i++) {
|
||||
const datum = elementData[i];
|
||||
if (ids === undefined || ids.includes(idOf(datum))) {
|
||||
this.computeElementDefaultStyle(elementType, { datum });
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -195,12 +197,14 @@ export class ElementController {
|
||||
*/
|
||||
private computeElementsStatesStyle(ids?: ID[]) {
|
||||
this.forEachElementData((elementType, elementData) => {
|
||||
elementData
|
||||
.filter((datum) => ids === undefined || ids.includes(idOf(datum)))
|
||||
.forEach((datum) => {
|
||||
const length = elementData.length;
|
||||
for (let i = 0; i < length; i++) {
|
||||
const datum = elementData[i];
|
||||
if (ids === undefined || ids.includes(idOf(datum))) {
|
||||
const states = this.getElementState(idOf(datum));
|
||||
this.computeElementStatesStyle(elementType, states, { datum });
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user