diff --git a/Assets/Editor/ChapterGraph/ChapterGraphEditorWindow.cs b/Assets/Editor/ChapterGraph/ChapterGraphEditorWindow.cs index c265e4f6c..0ae2735be 100644 --- a/Assets/Editor/ChapterGraph/ChapterGraphEditorWindow.cs +++ b/Assets/Editor/ChapterGraph/ChapterGraphEditorWindow.cs @@ -148,9 +148,19 @@ namespace AibisDream.SystemEditor }); // 右侧 GraphView + // 套一层容器:GraphView 与左侧 Inspector 并列放在 Flex Row 中时, + // 内置 RectangleSelector 绘制的框选矩形会出现坐标偏移(已知 Unity 问题)。 + // 将 GraphView 放在独立的 Flex 子容器中可使其局部原点与父容器对齐,规避该偏移。 + var graphViewWrapper = new VisualElement(); + graphViewWrapper.style.flexGrow = 1; + graphViewWrapper.style.flexDirection = FlexDirection.Column; + graphViewWrapper.style.overflow = Overflow.Hidden; + _graphView = new ChapterGraphView(); _graphView.style.flexGrow = 1; - mainContainer.Add(_graphView); + graphViewWrapper.Add(_graphView); + + mainContainer.Add(graphViewWrapper); root.Add(mainContainer);