Skip to content

fix(editor): anchor selector dropdowns to the element's owner window#147

Merged
VPDPersonal merged 2 commits into
mainfrom
fix/selector-anchor-owner-window
Jul 20, 2026
Merged

fix(editor): anchor selector dropdowns to the element's owner window#147
VPDPersonal merged 2 commits into
mainfrom
fix/selector-anchor-owner-window

Conversation

@VPDPersonal

@VPDPersonal VPDPersonal commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Type/Id/SerializeReference selector dropdowns opened in the wrong screen position when the inspector was an unfocused floating window: anchors were built from EditorWindow.focusedWindow, but UIToolkit dispatches the pointer event before focus moves, so the rect landed in the previously focused window's coordinate space (e.g. over the Project panel).

  • 🐛 Add VisualElementExtensions.GetOwnerWindow() — resolves the EditorWindow whose panel actually hosts the element, falling back to focused/mouse-over window for detached elements
  • ♻️ Use it for every dropdown anchor: SerializeReferenceField (dropdown + fix selector), TypeField, IdField, and the list + append picker
  • 📝 Document the new extension in VisualElementExtensions.md (EN/RU, Editor commands section)

Notes for review

  • ⚠️ SerializeReferenceSharedNavigation.ScrollTo intentionally keeps mouseOverWindow — it scrolls the window under the cursor, which is the correct semantics there
  • ✅ Unity 6000.4.0f1 batch compile clean (0 errors in package code)
🇷🇺 Описание на русском

Дропдауны селекторов Type/Id/SerializeReference открывались не в том месте экрана, когда инспектор был нефокусным плавающим окном: якорь строился от EditorWindow.focusedWindow, но UIToolkit доставляет pointer-событие до переключения фокуса, поэтому прямоугольник оказывался в системе координат прежнего окна (например, поверх панели Project).

  • 🐛 Добавлен VisualElementExtensions.GetOwnerWindow() — находит EditorWindow, чья панель реально содержит элемент, с откатом на focused/mouse-over окно для отсоединённых элементов
  • ♻️ Используется для всех якорей дропдаунов: SerializeReferenceField (дропдаун + Fix-селектор), TypeField, IdField и пикер кнопки + у списков
  • 📝 Новое расширение задокументировано в VisualElementExtensions.md (EN/RU, раздел Editor commands)

Заметки для ревью

  • ⚠️ SerializeReferenceSharedNavigation.ScrollTo намеренно оставлен на mouseOverWindow — там скроллится окно под курсором, это корректная семантика
  • ✅ Батч-компиляция Unity 6000.4.0f1 чистая (0 ошибок в коде пакета)

- Anchors were built from EditorWindow.focusedWindow, but a click into an unfocused floating window dispatches its pointer event before focus moves, so the picker opened in the previous window's coordinate space
- Add VisualElementExtensions.GetOwnerWindow() that resolves the EditorWindow whose panel hosts the element, falling back to focused/mouseOver window
- Apply it in SerializeReferenceField (dropdown + fix selector), TypeField, IdField and the list "+" append picker

Co-Authored-By: Claude <noreply@anthropic.com>
@VPDPersonal VPDPersonal added type: fix Bug fix status: work-in-progress Draft / not ready for review area: editor Editor-only code labels Jul 20, 2026
Co-Authored-By: Claude <noreply@anthropic.com>
@VPDPersonal
VPDPersonal marked this pull request as ready for review July 20, 2026 20:58
@github-actions github-actions Bot added status: needs-review Ready for review and removed status: work-in-progress Draft / not ready for review labels Jul 20, 2026
@VPDPersonal
VPDPersonal merged commit 0a43faf into main Jul 20, 2026
5 checks passed
@VPDPersonal
VPDPersonal deleted the fix/selector-anchor-owner-window branch July 20, 2026 20:58
@github-actions github-actions Bot removed the status: needs-review Ready for review label Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: editor Editor-only code type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant