JimmyPun610 / BarcodeScanner.Mobile

Barcode Scanner using GoogleVision API for Xamarin Form, Maui
MIT License
333 stars 100 forks source link

CameraView overlapping other views in MAUI (.NET8) #214

Open stepkillah opened 9 months ago

stepkillah commented 9 months ago

Describe the bug In MAUI version there are some issues with properly displaying CameraView.

To Reproduce Steps to reproduce the behavior:

  1. Open MAUI Sample App
  2. Open MVVM Demo page
  3. See that CameraView is overlapping over controls

Expected behavior CameraView should be displayed correctly in specified sizes, and Preview should fill available space, and crop what's out of the bounds. See Xamarin Forms screenshot

Screenshots MAUI Screenshot_1701623966 Xamarin Forms Screenshot_1701624031

Smartphone (please complete the following information):

Additional context I was trying to find what causes it and created PR to use the new ResolutionSelector, but it didn't fix the issue.

If set _previewView.SetScaleType(PreviewView.ScaleType.FitCenter) in CreatePlatformView - it affects this behavior, but it is not a fix, because it starts to fit the preview instead of filling

Known workarounds

Wrap CameraView into Frame and set ClipToBounds = true , but other issues appear like black camera view after the first scan.

Quaybe commented 8 months ago

Can confirm, the camera view does all sorts of craziness.

stepkillah commented 8 months ago

A partial workaround is to wrap CameraView into Frame and set ClipToBounds = true , but other issues appear like a black camera view after first scan.