Verify Views files against decompiled, extract embedded types
Fixed files: - SkiaImageButton.cs: Added SVG support with multi-path search - SkiaNavigationPage.cs: Added LinuxApplication.IsGtkMode check - SkiaRefreshView.cs: Added ICommand support (Command, CommandParameter) - SkiaTemplatedView.cs: Added missing using statements Extracted embedded types to separate files (matching decompiled pattern): - From SkiaMenuBar.cs: MenuBarItem, MenuItem, SkiaMenuFlyout, MenuItemClickedEventArgs - From SkiaNavigationPage.cs: NavigationEventArgs - From SkiaTabbedPage.cs: TabItem - From SkiaVisualStateManager.cs: SkiaVisualStateGroupList, SkiaVisualStateGroup, SkiaVisualState, SkiaVisualStateSetter - From SkiaSwipeView.cs: SwipeItem, SwipeStartedEventArgs, SwipeEndedEventArgs - From SkiaFlyoutPage.cs: FlyoutLayoutBehavior (already separate) - From SkiaIndicatorView.cs: IndicatorShape (already separate) - From SkiaBorder.cs: SkiaFrame - From SkiaCarouselView.cs: PositionChangedEventArgs - From SkiaCollectionView.cs: SkiaSelectionMode, ItemsLayoutOrientation - From SkiaContentPresenter.cs: LayoutAlignment Verified matching decompiled: - SkiaContextMenu.cs, SkiaFlexLayout.cs, SkiaGraphicsView.cs Build: 0 errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -202,106 +202,3 @@ public class VirtualizationManager<T> where T : SkiaView
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for virtualization.
|
||||
/// </summary>
|
||||
public static class VirtualizationExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Calculates visible item range for a vertical list.
|
||||
/// </summary>
|
||||
/// <param name="scrollOffset">Current scroll offset.</param>
|
||||
/// <param name="viewportHeight">Height of visible area.</param>
|
||||
/// <param name="itemHeight">Height of each item (fixed).</param>
|
||||
/// <param name="itemSpacing">Spacing between items.</param>
|
||||
/// <param name="totalItems">Total number of items.</param>
|
||||
/// <returns>Tuple of (firstVisible, lastVisible) indices.</returns>
|
||||
public static (int first, int last) CalculateVisibleRange(
|
||||
float scrollOffset,
|
||||
float viewportHeight,
|
||||
float itemHeight,
|
||||
float itemSpacing,
|
||||
int totalItems)
|
||||
{
|
||||
if (totalItems == 0)
|
||||
return (-1, -1);
|
||||
|
||||
var rowHeight = itemHeight + itemSpacing;
|
||||
var first = Math.Max(0, (int)(scrollOffset / rowHeight));
|
||||
var last = Math.Min(totalItems - 1, (int)((scrollOffset + viewportHeight) / rowHeight) + 1);
|
||||
|
||||
return (first, last);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates visible item range for variable height items.
|
||||
/// </summary>
|
||||
/// <param name="scrollOffset">Current scroll offset.</param>
|
||||
/// <param name="viewportHeight">Height of visible area.</param>
|
||||
/// <param name="getItemHeight">Function to get height of item at index.</param>
|
||||
/// <param name="itemSpacing">Spacing between items.</param>
|
||||
/// <param name="totalItems">Total number of items.</param>
|
||||
/// <returns>Tuple of (firstVisible, lastVisible) indices.</returns>
|
||||
public static (int first, int last) CalculateVisibleRangeVariable(
|
||||
float scrollOffset,
|
||||
float viewportHeight,
|
||||
Func<int, float> getItemHeight,
|
||||
float itemSpacing,
|
||||
int totalItems)
|
||||
{
|
||||
if (totalItems == 0)
|
||||
return (-1, -1);
|
||||
|
||||
int first = 0;
|
||||
float cumulativeHeight = 0;
|
||||
|
||||
// Find first visible
|
||||
for (int i = 0; i < totalItems; i++)
|
||||
{
|
||||
var itemHeight = getItemHeight(i);
|
||||
if (cumulativeHeight + itemHeight > scrollOffset)
|
||||
{
|
||||
first = i;
|
||||
break;
|
||||
}
|
||||
cumulativeHeight += itemHeight + itemSpacing;
|
||||
}
|
||||
|
||||
// Find last visible
|
||||
int last = first;
|
||||
var endOffset = scrollOffset + viewportHeight;
|
||||
for (int i = first; i < totalItems; i++)
|
||||
{
|
||||
var itemHeight = getItemHeight(i);
|
||||
if (cumulativeHeight > endOffset)
|
||||
{
|
||||
break;
|
||||
}
|
||||
last = i;
|
||||
cumulativeHeight += itemHeight + itemSpacing;
|
||||
}
|
||||
|
||||
return (first, last);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates visible item range for a grid layout.
|
||||
/// </summary>
|
||||
public static (int firstRow, int lastRow) CalculateVisibleGridRange(
|
||||
float scrollOffset,
|
||||
float viewportHeight,
|
||||
float rowHeight,
|
||||
float rowSpacing,
|
||||
int totalRows)
|
||||
{
|
||||
if (totalRows == 0)
|
||||
return (-1, -1);
|
||||
|
||||
var effectiveRowHeight = rowHeight + rowSpacing;
|
||||
var first = Math.Max(0, (int)(scrollOffset / effectiveRowHeight));
|
||||
var last = Math.Min(totalRows - 1, (int)((scrollOffset + viewportHeight) / effectiveRowHeight) + 1);
|
||||
|
||||
return (first, last);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user