object.contentBounds

类型 表格
对象 显示对象
display.*
修订版本 版本 2024.3703
关键词 内容边界

概述

一个只读表格,具有属性 xMinxMaxyMinyMax,表示 显示对象 的边界,以内容坐标表示。

示例

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