Initial start
This commit is contained in:
@@ -27,22 +27,9 @@ public class GtkWebViewProxy : SkiaView
|
||||
public override void Arrange(SKRect bounds)
|
||||
{
|
||||
base.Arrange(bounds);
|
||||
var windowBounds = TransformToWindow(bounds);
|
||||
_handler.RegisterWithHost(windowBounds);
|
||||
}
|
||||
|
||||
private SKRect TransformToWindow(SKRect localBounds)
|
||||
{
|
||||
float x = localBounds.Left;
|
||||
float y = localBounds.Top;
|
||||
|
||||
for (var parent = Parent; parent != null; parent = parent.Parent)
|
||||
{
|
||||
x += parent.Bounds.Left;
|
||||
y += parent.Bounds.Top;
|
||||
}
|
||||
|
||||
return new SKRect(x, y, x + localBounds.Width, y + localBounds.Height);
|
||||
// Bounds are already in absolute window coordinates - use them directly
|
||||
// The Skia layout system uses absolute coordinates throughout
|
||||
_handler.RegisterWithHost(Bounds);
|
||||
}
|
||||
|
||||
public override void Draw(SKCanvas canvas)
|
||||
|
||||
@@ -25,6 +25,8 @@ public partial class ImageButtonHandler : ViewHandler<IImageButton, SkiaImageBut
|
||||
[nameof(IPadding.Padding)] = MapPadding,
|
||||
[nameof(IView.Background)] = MapBackground,
|
||||
["BackgroundColor"] = MapBackgroundColor,
|
||||
[nameof(IView.Width)] = MapWidth,
|
||||
[nameof(IView.Height)] = MapHeight,
|
||||
};
|
||||
|
||||
public static CommandMapper<IImageButton, ImageButtonHandler> CommandMapper = new(ViewHandler.ViewCommandMapper)
|
||||
@@ -165,6 +167,28 @@ public partial class ImageButtonHandler : ViewHandler<IImageButton, SkiaImageBut
|
||||
}
|
||||
}
|
||||
|
||||
public static void MapWidth(ImageButtonHandler handler, IImageButton imageButton)
|
||||
{
|
||||
if (handler.PlatformView is null) return;
|
||||
|
||||
// Map WidthRequest from the MAUI ImageButton to the platform view
|
||||
if (imageButton is Microsoft.Maui.Controls.ImageButton imgBtn && imgBtn.WidthRequest > 0)
|
||||
{
|
||||
handler.PlatformView.WidthRequest = imgBtn.WidthRequest;
|
||||
}
|
||||
}
|
||||
|
||||
public static void MapHeight(ImageButtonHandler handler, IImageButton imageButton)
|
||||
{
|
||||
if (handler.PlatformView is null) return;
|
||||
|
||||
// Map HeightRequest from the MAUI ImageButton to the platform view
|
||||
if (imageButton is Microsoft.Maui.Controls.ImageButton imgBtn && imgBtn.HeightRequest > 0)
|
||||
{
|
||||
handler.PlatformView.HeightRequest = imgBtn.HeightRequest;
|
||||
}
|
||||
}
|
||||
|
||||
// Image source loading helper
|
||||
private ImageSourceServiceResultManager _sourceLoader = null!;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user