Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: dev env add fps monitor #6679

Merged
merged 1 commit into from
Jan 3, 2025
Merged

refactor: dev env add fps monitor #6679

merged 1 commit into from
Jan 3, 2025

Conversation

Aarebecca
Copy link
Contributor

开发环境添加帧率监控:

image

Copy link

Walkthrough

在开发环境中添加了帧率监控功能。通过引入 stats.js 库,在测试页面中增加了一个用于显示帧率的 div 元素,并在 main.ts 中初始化和更新帧率监控。

Changes

文件 描述
package.json 添加了 @types/stats.js 依赖。
packages/g6/tests/index.html 增加了一个用于显示帧率的 div 元素。
packages/g6/tests/main.ts 引入 stats.js 库,初始化帧率监控,并在渲染后更新帧率。

async function render() {
syncParamsToSearch();
applyTheme();
destroyForm();
if (canvas) {
canvas.getLayer().removeEventListener(CanvasEvent.AFTER_RENDER, statsListener);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确保在移除事件监听器之前,canvas 对象已被正确初始化,以避免潜在的空引用错误。可以考虑在此处添加一个检查:if (canvas && canvas.getLayer()) { ... }

@Aarebecca Aarebecca force-pushed the refactor/fps-monitor branch from 3288ed4 to 0229915 Compare January 3, 2025 11:23
@Aarebecca Aarebecca merged commit 1cc8cf2 into v5 Jan 3, 2025
2 checks passed
@Aarebecca Aarebecca deleted the refactor/fps-monitor branch January 3, 2025 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant