Skip to content

Commit 5b1eaec

Browse files
committed
fix(QuickMenu): Fix resizing the quick menu when the number of items changes
Fixes #1086
1 parent a3684d3 commit 5b1eaec

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

SoundSwitch.UI.Menu/Form/QuickMenu.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public void SetData(IEnumerable<IconMenuItem<T>.DataContainer> payloads)
6060
var toAdd = newPayloadsById.Keys.Except(_currentPayloads.Keys);
6161
var toModify = _currentPayloads.Keys.Intersect(newPayloadsById.Keys);
6262

63+
var currentPayloadSizeDifferentNewPayloads = _currentPayloads.Count != originalOrderPayloads.Length;
6364
var needRearrange = false;
6465

6566
var controlCollection = Controls;
@@ -101,9 +102,13 @@ public void SetData(IEnumerable<IconMenuItem<T>.DataContainer> payloads)
101102
Height = 0;
102103
}
103104

105+
if (!_isLocationSet || currentPayloadSizeDifferentNewPayloads)
106+
{
107+
Region = Region.FromHrgn(RoundedCorner.CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
108+
}
109+
104110
if (!_isLocationSet)
105111
{
106-
Region = Region.FromHrgn(RoundedCorner.CreateRoundRectRgn(0, 0, Width, Height , 20, 20));
107112
Show();
108113
SetLocationToCursor();
109114
_isLocationSet = true;

0 commit comments

Comments
 (0)