From 3bdc29da0fbab1fadf72b634de395d697d1e86e0 Mon Sep 17 00:00:00 2001 From: lilimin <461353919@qq.com> Date: Wed, 16 Sep 2026 18:17:50 +0800 Subject: [PATCH] fix(graph): fix roam trigger area drifting with the content after pan/zoom The roam (pan/zoom) trigger area of the graph series was glued to the content layer: GraphView registered the roam controller's isInSelf check as coordinateSystem.containPoint(), which tests the pointer against dataRect transformed by the roam matrix (mtOverall). The trigger area therefore moved along with pan/zoom and could drift partially or completely out of the viewport, leaving dead regions where roam could no longer be started. With force layout dataRect even falls back to viewRect (createView.ts isNaN branch), i.e. a static rect glued to the content layer. Test the pointer against getViewRect() - the layout viewport in the view layer, which excludes the roam transform - and fall back to the previous containPoint() check when no view rect is available. --- src/chart/graph/GraphView.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/chart/graph/GraphView.ts b/src/chart/graph/GraphView.ts index f5672a0e9d..dd082d4131 100644 --- a/src/chart/graph/GraphView.ts +++ b/src/chart/graph/GraphView.ts @@ -138,7 +138,18 @@ class GraphView extends ChartView implements RoamHostView { api, this._controller, function (e, x, y) { - return seriesModel.coordinateSystem.containPoint([x, y]); + // The roam trigger area should be the view layer (the layout + // viewport), not the roamed content: `containPoint` tests + // against `dataRect` transformed by the roam matrix, which + // moves along with pan/zoom and can drift out of the viewport, + // leaving dead areas where roam can no longer be started. + // With force layout `dataRect` even falls back to `viewRect`, + // i.e. a static rect glued to the content layer. + const coordSys = seriesModel.coordinateSystem; + const viewRect = coordSys.getViewRect && coordSys.getViewRect(); + return viewRect + ? viewRect.contain(x, y) + : coordSys.containPoint([x, y]); }, null, );