Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera Zoom #167

Open
Trainian opened this issue Apr 3, 2023 · 3 comments
Open

Camera Zoom #167

Trainian opened this issue Apr 3, 2023 · 3 comments
Labels
question Further information is requested

Comments

@Trainian
Copy link

Trainian commented Apr 3, 2023

Is there a possibility and how to use ZOOM cameras ?

@Trainian Trainian added the question Further information is requested label Apr 3, 2023
@Trainian
Copy link
Author

Trainian commented May 12, 2023

пришлось добавлять самому...

public interface ICameraView : IView
{
///code
        public float ZoomFactor { get; set; }
        public static BindableProperty ZoomFactorProperty { get; set; }
///code
}
public partial class CameraView : View, ICameraView
{
///code
        public static readonly BindableProperty ZoomFactorProperty = BindableProperty.Create(nameof(ZoomFactor), typeof(float), typeof(CameraView), 1f);

        public float ZoomFactor
        {
            get { return (float)GetValue(ZoomFactorProperty); }
            set { SetValue(ZoomFactorProperty, value); }
        }
///code
}

Для ANDROID устройств (в файле CameraViewHandler.android.cs)

public partial class CameraViewHandler
{
///code
        private void CameraCallback()
        {
         ///code after _camera = cameraProvider.BindToLifecycle(lifecycleOwner, cameraSelector, preview, imageAnalyzer);
    
```            SetZoomFactor(VirtualView.ZoomFactor);
         ///code
        }
        private void SetZoomFactor(float zoom)
        {
            if (_camera == null)
                throw new Exception("Zooming Error");
            _camera.CameraControl.SetZoomRatio(zoom);
        }
///code
}

@mos379
Copy link
Contributor

mos379 commented May 14, 2023

@Trainian why don't you create a PR to add this?

or @JimmyPun610 maybe you can add it?

@Trainian
Copy link
Author

потому что это далеко не идеальное решение, а временное и используется только при инициализации, без возможности менять на лету. Разработчики дополнения гораздо лучше и эффективней могут сделать, чем моё решение.

because this is far from an ideal solution, but a temporary one and is used only during initialization, without the ability to change on the fly. The developers of the add-on can do much better and more efficiently than my solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants