-
Notifications
You must be signed in to change notification settings - Fork 92
gpqr-add-support-for-camera-zoom.js: Added support for camera zoom during QR code scanning.
#1084
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
Conversation
…during QR code scanning.
WalkthroughA new JavaScript snippet has been introduced to enable camera zoom functionality in the Gravity Perks GP QR Code scanner. This is achieved by hooking into the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GravityForms
participant QRCodeScanner
participant CustomJS
User -> GravityForms: Loads QR Code scanner
GravityForms -> QRCodeScanner: Initialize scanner config
QRCodeScanner -> CustomJS: Emit gpqr_scanner_config filter event
CustomJS -> QRCodeScanner: Modify config (showZoomSliderIfSupported = true)
QRCodeScanner -> User: Display scanner with zoom slider (if supported)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
gp-qr-code/gpqr-add-support-for-camera-zoom.js (1)
10-13: Ensure robustness and improve readability.
To avoid a runtime error if this script executes before the Gravity Formsgformobject is available—and to follow common JavaScript conventions—consider:
- Guarding against a missing
gform.addFiltermethod.- Using dot notation (
config.showZoomSliderIfSupported) for a static property.Apply this diff:
-window.gform.addFilter( 'gpqr_scanner_config', function( config, instance, formats ) { - config['showZoomSliderIfSupported'] = true; - return config; -} ); +if ( window.gform && typeof window.gform.addFilter === 'function' ) { + window.gform.addFilter( + 'gpqr_scanner_config', + function( config, instance, formats ) { + config.showZoomSliderIfSupported = true; + return config; + } + ); +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
gp-qr-code/gpqr-add-support-for-camera-zoom.js(1 hunks)
🔇 Additional comments (1)
gp-qr-code/gpqr-add-support-for-camera-zoom.js (1)
1-9: Header and instructions are clear.
The file header succinctly describes the snippet’s purpose, links to documentation, and provides installation steps for the Custom JavaScript plugin.
saifsultanc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! S&M.
Context
⛑️ Ticket(s): https://secure.helpscout.net/conversation/2905448332/82090
Reference: https://github.com/gravitywiz/gp-qr-code/pull/30#issuecomment-2825270328
Summary
By default, disable camera zoom during QR code scanning. This snippet helps you enable camera zoom during QR code scanning.