Skip to content

Commit

Permalink
fix(QuickMenu): Fix resizing the quick menu when the number of items …
Browse files Browse the repository at this point in the history
…changes

Fixes #1086
  • Loading branch information
Belphemur committed Jan 7, 2023
1 parent a3684d3 commit 5b1eaec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion SoundSwitch.UI.Menu/Form/QuickMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void SetData(IEnumerable<IconMenuItem<T>.DataContainer> payloads)
var toAdd = newPayloadsById.Keys.Except(_currentPayloads.Keys);
var toModify = _currentPayloads.Keys.Intersect(newPayloadsById.Keys);

var currentPayloadSizeDifferentNewPayloads = _currentPayloads.Count != originalOrderPayloads.Length;
var needRearrange = false;

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

if (!_isLocationSet || currentPayloadSizeDifferentNewPayloads)
{
Region = Region.FromHrgn(RoundedCorner.CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
}

if (!_isLocationSet)
{
Region = Region.FromHrgn(RoundedCorner.CreateRoundRectRgn(0, 0, Width, Height , 20, 20));
Show();
SetLocationToCursor();
_isLocationSet = true;
Expand Down

0 comments on commit 5b1eaec

Please sign in to comment.