@heybox/hb-sdk API Reference - v0.9.5
    正在准备搜索索引...

    接口 MiniProgramWindowInfoResult

    小程序窗口信息。

    该结构统一描述调用时的屏幕尺寸、可用窗口尺寸、安全区域与顶部偏移等容器信息。 窗口可缩放的平台上,尺寸可能在后续用户拖拽后变化;需要最新值时重新调用 viewport.getWindowInfo()。

    Runtime 会把无效 pixelRatio 降级为 1,把无效屏幕尺寸降级为对应窗口尺寸, 把无效窗口尺寸降级为 0。导航栏高度读取失败或返回无效值时,statusBarHeight 与 screenTop 均降级为 0;安全区域再基于这些归一化值计算。

    interface MiniProgramWindowInfoResult {
        pixelRatio: number;
        safeArea: MiniProgramSafeArea;
        screenHeight: number;
        screenTop: number;
        screenWidth: number;
        statusBarHeight: number;
        windowHeight: number;
        windowWidth: number;
    }
    索引

    属性

    pixelRatio: number

    设备像素比;Host 返回非有限值或非正数时为 1。

    当前窗口内经过边界夹取并补齐 width、height 的安全区域。

    screenHeight: number

    屏幕高度,单位逻辑像素;Host 值无效时退回到 windowHeight。

    screenTop: number

    顶部可用偏移兼容值,单位逻辑像素;当前恒等于 statusBarHeight。

    screenWidth: number

    屏幕宽度,单位逻辑像素;Host 值无效时退回到 windowWidth。

    statusBarHeight: number

    状态栏或顶部导航占用高度,单位逻辑像素;读取失败或值无效时为 0。

    windowHeight: number

    当前小程序可使用的窗口内容高度,单位逻辑像素;Host 值无效时为 0。

    windowWidth: number

    当前小程序可使用的窗口内容宽度,单位逻辑像素;Host 值无效时为 0。