interface TagConfig<C> {
    _isMerged?: boolean;
    clickable?: boolean;
    initialData?: PartialObjectDeep<ContentTypeMap[C]> & {
        important?: boolean;
    };
    initialState?: {
        unfolded?: boolean;
        visible?: boolean;
    };
    modelConfig?: {
        autoLookAtEnabled?: boolean;
    };
    renderType?: "Mesh" | "Dom";
    simulate3D?: boolean;
    tag3DConfig?: {
        autoRender?: boolean;
        container?: HTMLElement;
        devicePixelRatio?: number;
        dpr?: number;
        pointerEvents?: "none" | "auto";
        ratio?: number;
        wrapperStyle?: Partial<CSSStyleDeclaration>;
    } & ({
        mode?: "front";
    } | {
        behindFiveContainer?: HTMLElement;
        mode: "behind";
    });
    unfoldedConfig?: ConfigFunction | {
        autoFoldWhenHide?: false;
        autoUnfold?:
            | false
            | {
                autoUnfoldProjectX?: MinMax;
                enable?: boolean;
                strategy?: "ScreenPostion";
            }
            | {
                distance?: MinMax;
                enable?: boolean;
                maxNumber?: number;
                strategy?: "MinimumDistance";
            }
            | {
                enable?: boolean;
                strategy?: "FoldWhenMove";
            };
        disableFold?: true;
        disableUnfold?: true;
        keep?: "folded" | "unfolded";
        unfoldDistance?: MinMax;
    };
    visibleConfig?: {
        alwaysShowWhenMovePano?: boolean;
        angleRange?: MinMax;
        entryFromModel?: boolean;
        followModelVisibility?: boolean;
        intersectRaycaster?: boolean | {
            checkPoints?: Vector3[] | "center" | "corner";
            distanceAccuracy?: number;
            enabled?: boolean;
            needPassed?: number;
        };
        keep?: "hidden" | "visible";
        visibleDistance?: MinMax | "unLimited";
        visibleFiveMode?: TagVisibleMode | ((tag: TagInstance) => TagVisibleMode);
        visiblePanoIndex?: number[] | "all" | "current";
    } | ConfigFunction;
}

Type Parameters

Properties

_isMerged?: boolean

private property

clickable?: boolean

是否可以点击

true
initialData?: PartialObjectDeep<ContentTypeMap[C]> & {
    important?: boolean;
}

Type declaration

  • Optionalimportant?: boolean

    类似 css 的 !important,会覆盖掉 tag.data 中对应的数据

     if (initialData.important) {
    tag.data = ObjectAssignDeep(tag.data, initialData)
    } else {
    tag.data = ObjectAssignDeep(initialData, tag.data)
    }

标签的默认数据,会将 tag.data 深度合并进来

tag.data = ObjectAssignDeep(initialData, tag.data)

initialState?: {
    unfolded?: boolean;
    visible?: boolean;
}

初始状态

Type declaration

  • Optionalunfolded?: boolean

    展开状态

  • Optionalvisible?: boolean

    展示状态

modelConfig?: {
    autoLookAtEnabled?: boolean;
}
renderType?: "Mesh" | "Dom"

当图片为一张时可以选择通过Mesh渲染

'Dom'
simulate3D?: boolean

是否模拟近大远小的效果

false
tag3DConfig?: {
    autoRender?: boolean;
    container?: HTMLElement;
    devicePixelRatio?: number;
    dpr?: number;
    pointerEvents?: "none" | "auto";
    ratio?: number;
    wrapperStyle?: Partial<CSSStyleDeclaration>;
} & ({
    mode?: "front";
} | {
    behindFiveContainer?: HTMLElement;
    mode: "behind";
})

Type declaration

  • OptionalautoRender?: boolean
  • Optionalcontainer?: HTMLElement
  • OptionaldevicePixelRatio?: number
  • Optionaldpr?: number

    dpr renamed as devicePixelRatio

  • OptionalpointerEvents?: "none" | "auto"
  • Optionalratio?: number
  • OptionalwrapperStyle?: Partial<CSSStyleDeclaration>

内部使用 css3DRenderer 渲染的标签可以使用此配置来设置 css3DRenderer 相关参数

unfoldedConfig?: ConfigFunction | {
    autoFoldWhenHide?: false;
    autoUnfold?:
        | false
        | {
            autoUnfoldProjectX?: MinMax;
            enable?: boolean;
            strategy?: "ScreenPostion";
        }
        | {
            distance?: MinMax;
            enable?: boolean;
            maxNumber?: number;
            strategy?: "MinimumDistance";
        }
        | {
            enable?: boolean;
            strategy?: "FoldWhenMove";
        };
    disableFold?: true;
    disableUnfold?: true;
    keep?: "folded" | "unfolded";
    unfoldDistance?: MinMax;
}

Type declaration

  • OptionalautoFoldWhenHide?: false

    划动到不可见状态时,自动收起,disableFold: true 的标签不受此参数影响

    部分标签是无法收起的

    true
    
  • OptionalautoUnfold?:
        | false
        | {
            autoUnfoldProjectX?: MinMax;
            enable?: boolean;
            strategy?: "ScreenPostion";
        }
        | {
            distance?: MinMax;
            enable?: boolean;
            maxNumber?: number;
            strategy?: "MinimumDistance";
        }
        | {
            enable?: boolean;
            strategy?: "FoldWhenMove";
        }

    自动展开策略

    'ScreenPostion':根据屏幕位置展开

    'MinimumDistance':最近标签自动展开

    'FoldWhenMove':移动屏幕自动收起

  • OptionaldisableFold?: true

    replace by { keep: 'unfolded' }

    部分标签是无法收起的

    undefined
    
  • OptionaldisableUnfold?: true

    replace by { keep: 'folded' }

    部分标签是无法打开的

    undefined
    
  • Optionalkeep?: "folded" | "unfolded"

    保持展开/收起,设置后unfoldedConfig下所有其他配置都不生效

    null
    
  • OptionalunfoldDistance?: MinMax

    min-max米内自动展开,否则收起

展开/收起相关配置

visibleConfig?: {
    alwaysShowWhenMovePano?: boolean;
    angleRange?: MinMax;
    entryFromModel?: boolean;
    followModelVisibility?: boolean;
    intersectRaycaster?: boolean | {
        checkPoints?: Vector3[] | "center" | "corner";
        distanceAccuracy?: number;
        enabled?: boolean;
        needPassed?: number;
    };
    keep?: "hidden" | "visible";
    visibleDistance?: MinMax | "unLimited";
    visibleFiveMode?: TagVisibleMode | ((tag: TagInstance) => TagVisibleMode);
    visiblePanoIndex?: number[] | "all" | "current";
} | ConfigFunction

Type declaration

  • OptionalalwaysShowWhenMovePano?: boolean

    现在全部标签走点时都不隐藏

  • OptionalangleRange?: MinMax

    3D标签中 「标签所在平面或垂直于标签法线的平面」 与 「摄像机到标签点或中心点的向量」 的夹角,范围内自动展开,范围外自动收起

    只在全景模式下生效

    undefined
    
  • OptionalentryFromModel?: boolean

    全景标签在模型中可见,点击后进入全景看向标签

    false
    
  • OptionalfollowModelVisibility?: boolean

    当 visibleFiveMode 包含 'Floorplan' 或者 'MapView' 时,是否仅在当前楼层模型下可见

    false
    
  • OptionalintersectRaycaster?: boolean | {
        checkPoints?: Vector3[] | "center" | "corner";
        distanceAccuracy?: number;
        enabled?: boolean;
        needPassed?: number;
    }

    碰撞检测配置

    true
    
  • Optionalkeep?: "hidden" | "visible"

    visibleFiveMode 指定的 mode 中,保持可见/不可见。设置后 visibleConfig 中除了 visibleFiveMode 外的所有其他配置都不生效

    null
    
    // 在 Panorama 和 Floorplan 模式下永远保持可见
    const config = {
    keep: 'visible',
    visibleFiveMode: ['Panorama', 'Floorplan'],
    }
    // 在 tag.fiveState.mode 中时,永远保持可见
    const config = {
    keep: 'visible',
    }
  • OptionalvisibleDistance?: MinMax | "unLimited"

    配置可见距离

    只在全景模式下生效

    'unLimited'
    
  • OptionalvisibleFiveMode?: TagVisibleMode | ((tag: TagInstance) => TagVisibleMode)

    在哪些 five mode 下可见

    默认值的设定是在 config 合并后,而不是合并前

    普通全景模式:['Panorama']
    
    const tag = {
    ...
    fiveState: {
    mode: 'Floorplan',
    }
    ...
    config: {},
    }
    // 相当于
    const tag = {
    ...
    fiveState: {
    mode: 'Floorplan',
    }
    ...
    config: {
    visibleFiveMode: 'Floorplan',
    },
    }
  • OptionalvisiblePanoIndex?: number[] | "all" | "current"

    配置标签可见点位

    只在全景模式下生效

    不限制

    仅当前点位可见

    仅指定点位可见

    'all'
    

显示/隐藏相关配置