object.contentBounds

Type Table
Object DisplayObject
Library display.*
Revision Release 2022.3683
Keywords content bounds

Overview

A read-only table with properties xMin, xMax, yMin, yMax that represent the boundaries of a display object, in content coordinates.

Example

local rect = display.newRect( 100, 100, 50, 50 )
rect:setFillColor( 1, 0, 0 )

local bounds = rect.contentBounds 
print( "xMin: ".. bounds.xMin ) -- xMin: 75
print( "yMin: ".. bounds.yMin ) -- yMin: 75
print( "xMax: ".. bounds.xMax ) -- xMax: 125
print( "yMax: ".. bounds.yMax ) -- yMax: 125