AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones específicas para móviles / Funciones Sensor
  • Device orientation: definitions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
SensorGetOrientation (Function)
In french: CapteurRécupèreOrientation
Retrieves the current orientation of the device on one of its 3 axes.
Example
nOrientation is int
nOrientation = SensorGetOrientation(snrAzimuth)
IF ErrorOccurred = True THEN
	Error(ErrorInfo())
	RETURN
END
Info(StringBuild("Orientation du téléphone par rapport au Nord : %1 degrés", nOrientation))
// Appareil en mode portrait ou paysage ?
IF Abs(SensorGetOrientation(snrRoll)) < 45 THEN
	// Appareil en mode portrait
ELSE
	// Appareil en mode paysage
END

// Appareil à plat ou à la verticale ?
IF Abs(SensorGetOrientation(snrPitch)) < 45 THEN
	// Appareil à plat
ELSE
	// Appareil à la verticale
END
Syntax
<Result> = SensorGetOrientation(<Orientation type>)
<Result>: Integer
Orientation of the device expressed in degrees according to the requested type of orientation.
<Orientation type>: Integer constant
Type of orientation to return:
snrAzimuthOrientation around the vertical axis (Z).
snrPitchOrientation around the horizontal axis (X).
snrRollOrientation around the longitudinal axis (Y).
Remarks

Device orientation: definitions

The change of orientation can be specified according to the three following dimensions:
  • Azimuth Direction of object snapping with respect to magnetic North around vertical axis (Z). This direction is expressed in degrees (from 0 to 360 degrees). In this case, 0 or 360 corresponds to the North, 90 corresponds to the East, 180 corresponds to the South and 270 corresponds to the West.
  • Pitch Rotation of the device around the horizontal axis (X). This rotation is expressed in degrees (from -180 to 180). Its value is set to 0 degree when the device lies down flat with the screen pointing to the ceiling, -90 degrees when the device stands still with the top of the device pointing to the ceiling, 90 degrees when the device stands still with the top of the device pointing to the ground and -180/180 degrees when the device lies down flat with the screen pointing to the ground.
  • Roll Rotation of the device around the longitudinal axis (Y). This rotation is expressed in degrees (from -90 to 90). Its value is set to 0 degree when the device lies down flat with the screen pointing to the ceiling, -90 degrees when the screen is oriented to the left and 90 degrees when the screen is oriented to the right.
Origin of the orientation
Coordinate system (assuming the device is laying flat, with the screen facing up):
  • The origin is found in the lower-left corner of the screen.
  • The X-axis represents the horizontal axis and it points to the right of the screen.
  • The Y-axis represents the longitudinal axis and it points to the top of the screen.
  • The Z-axis represents the vertical axis and it points outside the front of the screen.
Component: WDJS.DLL
Versión mínima requerida
  • Versión 16
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local