Fixed issue, where changing DPI scaling on monitor would detach visual elements from toolbar and not reattach/rebuild
This commit is contained in:
parent
a9576ce008
commit
708b99f763
|
|
@ -2,6 +2,12 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
|
||||
|
||||
## [1.11.4] - 2025-09-21
|
||||
|
||||
### Fixed
|
||||
- Fixed issue, where changing DPI scaling on monitor would detach visual elements from toolbar and not reattach/rebuild
|
||||
|
||||
|
||||
## [1.11.3] - 2025-05-11
|
||||
|
||||
### Changed
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
}
|
||||
}
|
||||
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
private static void OnUpdateElements(VisualElement leftAlign, VisualElement rightAlign)
|
||||
{
|
||||
const float HEIGHT = 22.0f;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
private static VisualElement CURRENT_PARENT_LEFT;
|
||||
private static VisualElement CURRENT_PARENT_RIGHT;
|
||||
private static int CURRENT_INSTANCE_ID;
|
||||
private static FieldInfo FIELD_INFO_ROOT;
|
||||
#endif
|
||||
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
|
|
@ -59,8 +60,10 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
CURRENT_PARENT_RIGHT?.RemoveFromHierarchy();
|
||||
CURRENT_PARENT_RIGHT = null;
|
||||
|
||||
FieldInfo root = CURRENT_TOOLBAR.GetType().GetField("m_Root", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
object rawRoot = root?.GetValue(CURRENT_TOOLBAR);
|
||||
if (FIELD_INFO_ROOT == null)
|
||||
FIELD_INFO_ROOT = CURRENT_TOOLBAR.GetType().GetField("m_Root", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
|
||||
object rawRoot = FIELD_INFO_ROOT?.GetValue(CURRENT_TOOLBAR);
|
||||
CURRENT_ROOT = rawRoot as VisualElement;
|
||||
|
||||
if (CURRENT_ROOT != null)
|
||||
|
|
@ -121,6 +124,10 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
});
|
||||
}
|
||||
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
result.RegisterCallbackOnce<DetachFromPanelEvent>(OnDetachedFromPanel);
|
||||
#endif
|
||||
|
||||
parent.Add(result);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -219,5 +226,12 @@ namespace Module.NavigationTool.Editor.Toolbar
|
|||
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
private static void OnDetachedFromPanel(DetachFromPanelEvent evt)
|
||||
{
|
||||
CURRENT_INSTANCE_ID = -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "com.module.navigationtool",
|
||||
"version": "1.11.3",
|
||||
"version": "1.11.4",
|
||||
"displayName": "Module.NavigationTool",
|
||||
"description": "Support for navigation tools, like favorites, history and toolbars",
|
||||
"unity": "2019.2",
|
||||
|
|
|
|||
Loading…
Reference in a new issue