Fix auto-docking windows on open when system DPI scale is not 1
This commit is contained in:
@@ -63,12 +63,9 @@ namespace FlaxEditor.GUI.Docking
|
||||
public bool IsHidden => !Visible || _dockedTo == null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default window size.
|
||||
/// Gets the default window size (in UI units, unscaled by DPI which is handled by windowing system).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Scaled by the DPI, because the window should be large enough for its content on every monitor
|
||||
/// </remarks>
|
||||
public virtual Float2 DefaultSize => new Float2(900, 580) * DpiScale;
|
||||
public virtual Float2 DefaultSize => new Float2(900, 580);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the serialization typename.
|
||||
|
||||
@@ -676,7 +676,9 @@ namespace FlaxEditor.Modules
|
||||
if (newLocation == DockState.Float)
|
||||
{
|
||||
// Check if there is a floating window that has the same size
|
||||
var defaultSize = window.DefaultSize;
|
||||
var dpi = (float)Platform.Dpi / 96.0f;
|
||||
var dpiScale = Platform.CustomDpiScale;
|
||||
var defaultSize = window.DefaultSize * dpi;
|
||||
for (var i = 0; i < Editor.UI.MasterPanel.FloatingPanels.Count; i++)
|
||||
{
|
||||
var win = Editor.UI.MasterPanel.FloatingPanels[i];
|
||||
@@ -688,7 +690,7 @@ namespace FlaxEditor.Modules
|
||||
}
|
||||
}
|
||||
|
||||
window.ShowFloating(defaultSize);
|
||||
window.ShowFloating(defaultSize * dpiScale);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user