截图区域。
坐标与尺寸均使用当前小程序可见窗口的逻辑像素,原点是窗口左上角,与 viewport.getWindowInfo 返回的 windowWidth、windowHeight 使用同一坐标系。TypeScript 调用方应传有限 number;当前 Runtime 会先用 Number(...) 转换 JavaScript 值再校验范围,因此字符串、boolean、null 等可能被兼容转换,业务不应依赖该宽松行为。Runtime 不会取整,也不会把矩形夹取到窗口边界;调用方应确保 left + width <= windowWidth、top + height <= windowHeight。
windowWidth
windowHeight
Number(...)
null
left + width <= windowWidth
top + height <= windowHeight
省略整个 rect 时,Runtime 会在调用时读取当前窗口并构造 { left: 0, top: 0, width: windowWidth, height: windowHeight }。窗口可能在用户拖动、 旋转设备或 Host 恢复后变化,不要长期缓存旧矩形。
rect
{ left: 0, top: 0, width: windowWidth, height: windowHeight }
截图区域高度,单位逻辑像素;必须是有限且大于 0 的数。
0
截图区域左边缘距窗口左边缘的逻辑像素数;转换后必须有限且大于等于 0。
截图区域上边缘距窗口上边缘的逻辑像素数;必须是有限且大于等于 0 的数。
截图区域宽度,单位逻辑像素;必须是有限且大于 0 的数。
截图区域。
备注
坐标与尺寸均使用当前小程序可见窗口的逻辑像素,原点是窗口左上角,与 viewport.getWindowInfo 返回的
windowWidth、windowHeight使用同一坐标系。TypeScript 调用方应传有限 number;当前 Runtime 会先用Number(...)转换 JavaScript 值再校验范围,因此字符串、boolean、null等可能被兼容转换,业务不应依赖该宽松行为。Runtime 不会取整,也不会把矩形夹取到窗口边界;调用方应确保left + width <= windowWidth、top + height <= windowHeight。省略整个
rect时,Runtime 会在调用时读取当前窗口并构造{ left: 0, top: 0, width: windowWidth, height: windowHeight }。窗口可能在用户拖动、 旋转设备或 Host 恢复后变化,不要长期缓存旧矩形。参阅