Hi, thought this would be easy, but there’s no way to check whether the the screen is currently locked, so it seems to be more complicated than I thought. I want a button to toggle the screen lock for the current orientation. Anyone have any ideas to a best approach? Cheers.
Yes, I am speaking of with the screen orientation plugin.
This is what ended up working for me. You have to go into the view with the screen orientation locked.
lockOrUnlockRotation() {
if (this.lockState === true) {
this.screenOrientation.unlock()
this.lockState = false
} else {
if (this.screenOrientation.type == "landscape-secondary") {
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE_SECONDARY);
} else {
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT);
}
this.lockState = true
}
}
1 Like