Skip to content

Commit

Permalink
Work around sizing issue on ios/catalyst for floor level list
Browse files Browse the repository at this point in the history
Likely caused by dotnet/maui#16304
This workaround does mean it doesn't properly resize to all height.
  • Loading branch information
dotMorten committed Aug 8, 2023
1 parent 1300cfd commit 01f128e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/Toolkit/Toolkit.Maui/FloorFilter/FloorFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -593,25 +593,30 @@ private void UpdateLevelListSize()

const int maxHeight = 320;
var desiredHeight = (_displayLevels?.Count ?? 0) * 48;

#if _IOS__ || __MACCATALYST__
var limitedHeight = Math.Min(maxHeight, desiredHeight);
PART_LevelListView.VerticalOptions = LayoutOptions.End;
PART_LevelListView.HeightRequest = limitedHeight;
PART_LevelListContainer?.SetValue(MaximumHeightRequestProperty, limitedHeight + 2);
#endif
if (desiredHeight > maxHeight)
{
PART_LevelListView.VerticalScrollBarVisibility = ScrollBarVisibility.Always;

// ScrollTo causes fail fast excepion in kernelbase.dll
#if !WINDOWS
#if !WINDOWS
if (SelectedLevel != null && DisplayLevels != null)
{
PART_LevelListView?.ScrollTo(DisplayLevels.IndexOf(SelectedLevel));
}
#endif
#endif
}
else if (DisplayLevels?.Any() == true)
{
PART_LevelListView.VerticalScrollBarVisibility = ScrollBarVisibility.Never;
#if !WINDOWS
#if !WINDOWS
PART_LevelListView?.ScrollTo(DisplayLevels.Count - 1);
#endif
#endif
}
}
}
Expand All @@ -621,5 +626,5 @@ private void UpdateLevelListSize()
/// </summary>
/// <remarks>The 'All Floors' button is useful in 3D.</remarks>
public bool ShowAllFloorsButton => GeoView is SceneView sv && sv.Scene is not null && SelectedFacility != null && SelectedFacility.Levels.Count > 1;
#endregion UI State Management
#endregion UI State Management
}

0 comments on commit 01f128e

Please sign in to comment.