Skip to content

Comments

feat: Manual Focus point #284#285

Open
CmdrDats wants to merge 6 commits intocapawesome-team:mainfrom
StakaraLabs:main
Open

feat: Manual Focus point #284#285
CmdrDats wants to merge 6 commits intocapawesome-team:mainfrom
StakaraLabs:main

Conversation

@CmdrDats
Copy link

@CmdrDats CmdrDats commented Jul 9, 2025

Pull request checklist

Please check if your PR fulfills the following requirements:

  • The changes have been tested successfully.
  • A changeset has been created (npm run changeset).
  • I have read and followed the pull request guidelines.

@CmdrDats CmdrDats changed the title feat: Manual AutoFocus point #284 feat: Manual Focus point #284 Jul 9, 2025

@objc func setFocusPoint(_ call: CAPPluginCall) {
guard let x = call.getFloat("x"), let y = call.getFloat("y") else {
call.reject("x and y coordinates must be provided.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define the error at the top of the file as property.

}

guard device.isFocusPointOfInterestSupported else {
throw RuntimeError("Focus point not supported")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define this error message in the BarcodeScannerPlugin.swift file as property.

Float y = call.getFloat("y");

if (x == null || y == null) {
call.reject("x and y coordinates must be provided.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@CmdrDats
Copy link
Author

real painful thing here is that I actually need continuous focus mode for my case - ios supports it cleanly with a 'continuousFocusMode' mode, but for Android, it seems we'd have to setup and manage a looper, which blows out the complexity of the change a bit (since we have to manage the lifecycle of that as well).

I had actually built out this and added an option in the focusmodeoptions so that you can choose, but then decided to revert and ask what your preference would be for this? Are you ok with a slightly larger native implementation for focus mode (on the android side, in particular), or would you prefer to keep the implementation tighter and have the client code manage a loop instead (not as ideal for the ios side)?

@robingenz
Copy link
Member

@CmdrDats I guess this would strongly increase the maintenance effort for a feature that has only been requested once so far and is rather special. For this reason, I am not currently planning to integrate such an implementation on Android.

@CmdrDats
Copy link
Author

ok, cool - glad I held off on that part then, thanks. I can definitely work around it with this version of the implementation.

@CmdrDats
Copy link
Author

Tested successfully again after changes on both Android and iOS with a client side continuous autofocus loop (3s interval timeout).

@CmdrDats CmdrDats requested a review from robingenz July 14, 2025 10:45
*
* Only available on Android and iOS.
*
* @since 8.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @since 8.0.0
* @since 7.3.0

Please run npm run docgen again.

/**
* X coordinate (0.0 = left, 1.0 = right)
*
* @since 8.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

/**
* Y coordinate (0.0 = top, 1.0 = bottom)
*
* @since 8.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

*
* @since 8.0.0
*/
x: number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this property optional and the default value should be 0.5. What do you think? Then we can remove a few checks and exceptions in the native layer.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a great idea - will do

*
* @since 8.0.0
*/
y: number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this property optional and the default value should be 0.5. What do you think? Then we can remove a few checks and exceptions in the native layer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants