capacitor-community / capacitor-community/camera-preview
X,Y position incorrect on iPhone 12 device
- Dominant language
- Java
- Stars
- 227
- Forks
- 185
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When I try to set a fixed X,Y position particularily on iPhone 12 (IOS 16.0.2) is not going correctly. The camera just fixes ok on 0,0. On iPhone 8 (IOS 15.6.1) or other devices like android runs correctly for every position. I don't know if is the same for all notch devices or just iPhone 12 or IOS version.
The X,Y reference is on top left corner of the camera at least on the another devices I have mentioned before, so I'm using it to use an html box of reference
**Screenshots**


**Smartphone (please complete the following information):**
- Device: iPhone 12
- OS: IOS 16.0.2
- Version 3.1.1
**Additional context**
Is not the last version of camera preview (3.1.1) but in the commits of the new ones there are no mention of this bug. Is not possible to simulate camera on Xcode so is very hard for me to replicate.
Here there are the configurations, for the final desired position.
```
const cameraPreviewOptions: CameraPreviewOptions = {
position: 'front',
parent: 'cameraPreview',
className: 'cameraPreview',
height: Number((height * 0.3).toFixed(0)),
width: Number((height * 0.3).toFixed(0)),
x: Number(((width / 2)).toFixed(0)), //absolute center
y: Number((height / 2).toFixed(0)),
toBack: true,
disableAudio: true//evita permisos inecesarios
};
let top_offset = ((height / 2) - header_height) - 65 - (cameraPreviewOptions.height / 2);//65 buttion required space
console.log('Top offset calculado: ', top_offset)
//Here position the camera center and move a desired fixed quantity on Y (variable header space of some devices with notch or something else at top)
cameraPreviewOptions.x -= Number((cameraPreviewOptions.width / 2).toFixed(0))
cameraPreviewOptions.y -= Number(((cameraPreviewOptions.height / 2) + top_offset).toFixed(0))
```
Contributor guide
Assessment
This issue has not been assessed yet.