gitlilimin opened a new pull request, #21754: URL: https://github.com/apache/echarts/pull/21754
## What does this PR do? Fix a bug in the `graph` series where the roam (pan/zoom) trigger area is glued to the content layer instead of the view layer. After the user pans (or zooms) the graph, the area in which a new pan/zoom gesture can be started moves along with the content and can drift partially or completely out of the viewport, leaving "dead" regions where roam no longer responds. ## Root cause `GraphView` registers the roam controller's `isInSelf` check as `coordinateSystem.containPoint([x, y])`. In `View.containPoint`, the test rectangle is `dataRect` transformed by `mtOverall`, which **includes the roam transform** — so the trigger area itself pans/zooms together with the content. With `force` layout this is even more confusing: nodes have no initial `x/y`, so `dataRect` falls back to `viewRect` (`createView.ts`, the `isNaN(aspect)` branch), making the trigger area a static rectangle (approximately the container at init, minus the aspect-preserving padding) that only moves with the roam transform. ## Reproduce 1. Open any force-layout graph with `roam: true` (e.g. enable roam on the official force layout example). 2. Pan the graph in one direction for a while. 3. Try to start a new pan by dragging from an area where the graph initially was not (or use the wheel to zoom there) — nothing happens. The interactive area has moved away together with the content. ## Fix Test the pointer against `getViewRect()` — the layout viewport in the view layer, which does not include the roam transform — instead of the roam-transformed `dataRect`. Falls back to the previous `containPoint` check if the coordinate system does not provide a view rect. The existing `roamTrigger: 'global'` option is unaffected (it already bypasses this check entirely); this fix makes the default behavior (`roamTrigger` unset / `'self'`) consistent: the trigger area is the series viewport and no longer drifts with pan/zoom. ## Test - Manually verified with a force-layout graph (~6k nodes / 2.5k edges, `roam: true`): before the fix, after panning, large dead areas appear where pan/zoom gestures are ignored; after the fix, roam can be started anywhere within the chart viewport regardless of previous pan/zoom. - `npm run lint` passes on the changed file; `lib` build (`build:lib`) compiles. Note: other series that register a similar `containPoint`-based check (e.g. `tree`, `sankey`) may share the same pattern — happy to follow up if you think it is worth aligning. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
