Skip to content

Commit

Permalink
perf: disable stack at proper lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanyan-Wang committed Sep 18, 2023
1 parent 89133b5 commit c6fb527
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions packages/g6/src/stdlib/behavior/drag-canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ export class DragCanvas extends Behavior {
return;
}
const section = sections.shift();
graph.hideItem(section, false, true);
graph.executeWithNoStack(() => {
graph.hideItem(section, false, true);
});
requestId = requestAnimationFrame(update);
};
graph.executeWithNoStack(() => {
requestId = requestAnimationFrame(update);
});
requestId = requestAnimationFrame(update);
}
}

Expand Down Expand Up @@ -285,12 +285,12 @@ export class DragCanvas extends Behavior {
cancelAnimationFrame(requestId);
return;
}
graph.startHistoryBatch();
graph.showItem(sections.shift(), false);
graph.stopHistoryBatch();
requestId = requestAnimationFrame(update);
};
graph.startHistoryBatch();
requestId = requestAnimationFrame(update);
graph.stopHistoryBatch();
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions packages/g6/src/stdlib/behavior/scroll-canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ export class ScrollCanvas extends Behavior {
return;
}
const section = sections.shift();
graph.startHistoryBatch();
graph.hideItem(section, false, true);
graph.stopHistoryBatch();
requestId = requestAnimationFrame(update);
};
graph.startHistoryBatch();
requestId = requestAnimationFrame(update);
graph.stopHistoryBatch();

if (currentZoom < optimizeZoom) {
this.hiddenNodeIds.push(...newHiddenNodeIds);
Expand Down Expand Up @@ -309,12 +309,12 @@ export class ScrollCanvas extends Behavior {
cancelAnimationFrame(requestId);
return;
}
graph.showItem(sections.shift(), false);
graph.executeWithNoStack(() => {
graph.showItem(sections.shift(), false);
});
requestId = requestAnimationFrame(update);
};
graph.executeWithNoStack(() => {
requestId = requestAnimationFrame(update);
});
requestId = requestAnimationFrame(update);

this.hiddenEdgeIds = this.hiddenNodeIds = [];
}
Expand Down
12 changes: 6 additions & 6 deletions packages/g6/src/stdlib/behavior/zoom-canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ export class ZoomCanvas extends Behavior {
return;
}
const section = sections.shift();
graph.startHistoryBatch();
graph.hideItem(section, false, true);
graph.stopHistoryBatch();
requestId = requestAnimationFrame(update);
};
graph.startHistoryBatch();
requestId = requestAnimationFrame(update);
graph.stopHistoryBatch();
}
}

Expand Down Expand Up @@ -180,12 +180,12 @@ export class ZoomCanvas extends Behavior {
cancelAnimationFrame(requestId);
return;
}
graph.showItem(sections.shift(), false);
graph.executeWithNoStack(() => {
graph.showItem(sections.shift(), false);
});
requestId = requestAnimationFrame(update);
};
graph.executeWithNoStack(() => {
requestId = requestAnimationFrame(update);
});
requestId = requestAnimationFrame(update);
}
}
this.hiddenEdgeIds = [];
Expand Down

0 comments on commit c6fb527

Please sign in to comment.