Skip to content

TWebDeviceOrientation

TWebDeviceOrientation is a non-visual component that can be used on devices that have a sensor to determine the physical orientation of a device. This is the case on any modern smartphone or tablet. It allows to adapt what is rendered on the GUI to the direction/orientation of the device.

Use the property WebDeviceOrientation.Enabled: Boolean to verify if the browser is running on a device with an orientation sensor. When it is detected, start capturing this sensor information via the method

WebDeviceOrientation.Start

After calling this, it starts triggering the event WebDeviceOrientation.OnDeviceOrientationChange that passes the orientation as a value between 0 and 360 degrees. 0 degrees meaning north orientation.

With the property WebDeviceOrientation.Started: Boolean, it can be determined whether the sensor capturing was started or not.