Open richardgazdik opened 6 years ago
Yes, the options which you pass in the startCamera function actually defines the x and y coords.
var options = {x: 10, y: 10, width: 300, height: 300, toBack: flase, previewDrag: true, tapPhoto: true};
CameraPreview.startCamera(options);
The above options would mean the top left corner of the preview will be at x=10 and y=10 with the size of the preview as 300x300.
Can I bind the startCamera function to a scroll event? (I'd like to change the preview's position in parallel with the view's scrollTop parameter).
This is exactly what I have been trying to achieve.
I would like to refactor setPreviewSize
and extend it to also take { x: number, y: number}
so that you can move the preview viewport.
According to https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview/blob/master/src/ios/CameraPreview.m#L19-L23 it looks like you cannot restart the camera without stopping it first, which is not very good for user interaction.
I see that if we modify these lines https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview/blob/master/src/ios/CameraPreview.m#L523-L526 to also include x
and y
coordinates and feed them into CGRectMake(x, y, width, height)
then we should accomplish what we want.
Any updates?
Is there a way to set the XY coords of the camera preview after initialisation? Although I can set the size of the preview window, positioning on runtime is still a missing feature.