display.safeScreenOriginX

Type Number
Library display.*
Revision Release 2024.3703
Keywords screen, origin, safe area
See also display.safeScreenOriginY
display.safeActualContentWidth
display.getSafeAreaInsets()

Overview

Returns the x distance from the left side of the “safe area” boundary to the left side of the content area, in Corona content units. The “safe area” is the rectangular region where it’s safe to place important UI elements, ensuring that they are not obscured by status bars, device aspects like a sensor bar or rounded corners, software buttons, TV overscan areas, etc.

For devices which do not feature the concept of a safe area, this value is the same as display.screenOriginX.

Example

-- Create a vector rectangle sized exactly to the "safe area"
local safeArea = display.newRect(
    display.safeScreenOriginX,
    display.safeScreenOriginY,
    display.safeActualContentWidth,
    display.safeActualContentHeight
)
safeArea:translate( safeArea.width*0.5, safeArea.height*0.5 )