antvis / antvis/X6

Scroller插件的autoResize是否能进行优化

Open
#4,086 4 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.7k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

### 功能描述

版本:"@antv/x6-plugin-scroller": "^2.0.10"

由于对于scroller的onUpdate方法进行了消抖操作,且时间为写死的200ms,在用户体验上不太友好,是否考虑优化一下
源码:https://github.com/antvis/X6/blob/3c5856d3f685dfd1ddd07f8d66ea45d3013ccb63/packages/x6-plugin-scroller/src/scroller.ts#L50
![GIF 2023-12-11 16-35-18](https://github.com/antvis/X6/assets/26105153/7ddbc43b-06ea-43c6-be9c-2293533e8b44)

### 期望解决方案

解决方案:
1. 暴露出这个刷新控制时间给用户自己控制
```ts
autoResize: boolean | { interval: number }
```

2. 把监听`model.on('cell:changed')`的方法改为监听`node`和`edge`的`moveing`事件,不进行消抖处理,这里不清楚为什么要监听`cell:changed`事件,而且真的要进行操作优化也应该是`throttle`而不是`debounce`

Contributor guide

Open the contributing guide

Research direction

Start in packages/x6-plugin-scroller/src/scroller.ts at the linked autoResize and onUpdate logic. Read how model.on('cell:changed') and the node and edge moving events are currently used, then compare the proposed interval option with throttle behavior. Done means the refresh timing or event handling matches the selected solution and the user-facing autoResize configuration works as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.