Shoot from the volume keys, while the camera is up
This commit is contained in:
@@ -31,6 +31,7 @@ import { LITE_FAVORITE_LIMIT, LITE_MARK, LITE_RECIPE_LIMIT, proLookInUse } from
|
||||
import { initProUnlock, useProUnlock } from './src/utils/proUnlock';
|
||||
import UltraWide from './modules/recipescam-ultrawide';
|
||||
import RecipescamExport from './modules/recipescam-export';
|
||||
import VolumeShutter from './modules/recipescam-volume';
|
||||
|
||||
// @ts-ignore
|
||||
import './global.css';
|
||||
@@ -1532,6 +1533,24 @@ export default function App() {
|
||||
}
|
||||
};
|
||||
|
||||
// Volume keys as a shutter release. `handleCapture` is rebuilt every render,
|
||||
// so the listener is bound once and reaches the current one through a ref.
|
||||
const captureFromKeyRef = useRef(handleCapture);
|
||||
captureFromKeyRef.current = handleCapture;
|
||||
useEffect(() => {
|
||||
const sub = VolumeShutter.addListener('onShutter', () => {
|
||||
void captureFromKeyRef.current();
|
||||
});
|
||||
return () => sub.remove();
|
||||
}, []);
|
||||
// Only the camera screen claims the keys; everywhere else (the library)
|
||||
// they stay volume keys.
|
||||
// ponytail: keyed off the mode alone, so a press behind a modal still
|
||||
// takes a frame - add the overlay flags here if that ever bites.
|
||||
useEffect(() => {
|
||||
VolumeShutter.setEnabled(mode === 'camera');
|
||||
}, [mode]);
|
||||
|
||||
// Held-shutter burst: press and hold the shutter, frames keep coming until
|
||||
// the finger lifts. Every frame is a normal capture (GPS resolve, RAW rules,
|
||||
// background render enqueue), so a burst photo is indistinguishable from a
|
||||
|
||||
Reference in New Issue
Block a user