Class ScreenOrientation

java.lang.Object
com.vaadin.flow.component.screenorientation.ScreenOrientation
All Implemented Interfaces:
Serializable

public final class ScreenOrientation extends Object implements Serializable
Entry point for the browser Screen Orientation API.

To observe the current orientation, subscribe to orientationSignal(). To pin the screen to a particular orientation for as long as the user stays on the current page, call lock(com.vaadin.flow.component.screenorientation.ScreenOrientationType) (most browsers require fullscreen first); release it again with unlock().


 Div portraitHint = new Div("Rotate your device to landscape");
 portraitHint.bindVisible(ScreenOrientation.orientationSignal()
         .map(data -> data.type().isPortrait()));

 ScreenOrientation.lock(ScreenOrientationType.LANDSCAPE_PRIMARY);
 
All methods operate on the current UI; the no-UI overloads require a current UI to be available on the calling thread.
Since:
25.2
See Also: