Skip to content

Commit 642fa9c

Browse files
committed
[Shell] Fix invalid dialog window size
1 parent 9d6d8f5 commit 642fa9c

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

WoWDatabaseEditor.Common/WDE.Common/Managers/IWindowManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public interface IAbstractWindowView
3434
bool IsMaximized { get; }
3535
(int x, int y) Position { get; }
3636
(int x, int y) Size { get; }
37+
(int x, int y) LogicalSize { get; }
3738
void Reposition(int x, int y, bool isMaximized, int width, int height);
3839
event Action? OnClosing;
3940
}

WoWDatabaseEditorCore.Avalonia/Managers/WindowManager.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,25 @@ public bool IsMaximized
7373
}
7474
}
7575

76+
public (int x, int y) LogicalSize
77+
{
78+
get
79+
{
80+
if (window.TryGetTarget(out var target))
81+
{
82+
return ((int)target.Width, (int)target.Height);
83+
}
84+
return (100, 100);
85+
}
86+
}
87+
7688
public (int x, int y) Size
7789
{
7890
get
7991
{
8092
if (window.TryGetTarget(out var target))
8193
{
82-
// we use screen coords for size so that size is custom app scaling independent
94+
// we use screen coords for size so that size is custom app scaling independent
8395
var screenTopLeftPoint = target.PointToScreen(new Point(target.Position.X, target.Position.Y));
8496
var screenBottomRightPoint = target.PointToScreen(new Point(target.Position.X + target.ClientSize.Width, target.Position.Y + target.ClientSize.Height));
8597
var width = screenBottomRightPoint.X - screenTopLeftPoint.X;

WoWDatabaseEditorCore.Avalonia/Services/TabularDataPickerService/TabularDataPickerPreferences.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void SetupWindow(string key, IAbstractWindowView window)
7777
window.OnClosing += () =>
7878
{
7979
var position = window.Position;
80-
var size = window.Size;
80+
var size = window.LogicalSize; // we use LogicalSize here, because then we set Width directly
8181
var maximized = window.IsMaximized;
8282
UpdateWindowState(key, maximized, position.x, position.y, size.x, size.y);
8383
};

0 commit comments

Comments
 (0)