Toggle screen orientation lock

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.

Maybe Screen Orientation Plugin can help you.

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.lockState = false
    } else {
      if (this.screenOrientation.type == "landscape-secondary") {
      } else {
      this.lockState = true
1 Like