增加测量窗口
This commit is contained in:
4781
dist/bim-engine-sdk.es.js
vendored
4781
dist/bim-engine-sdk.es.js
vendored
File diff suppressed because one or more lines are too long
2
dist/bim-engine-sdk.es.js.map
vendored
2
dist/bim-engine-sdk.es.js.map
vendored
File diff suppressed because one or more lines are too long
350
dist/bim-engine-sdk.umd.js
vendored
350
dist/bim-engine-sdk.umd.js
vendored
File diff suppressed because one or more lines are too long
2
dist/bim-engine-sdk.umd.js.map
vendored
2
dist/bim-engine-sdk.umd.js.map
vendored
File diff suppressed because one or more lines are too long
120
dist/index.d.ts
vendored
120
dist/index.d.ts
vendored
@@ -19,7 +19,7 @@ declare class BimButtonGroup implements IBimComponent {
|
||||
protected emit<K extends keyof EngineEvents>(event: K, payload: EngineEvents[K]): void;
|
||||
private initContainer;
|
||||
/**
|
||||
* 设置事件拦截,防止事件<EFBFBD><EFBFBD>泡到下层元素(如 3D 引擎)
|
||||
* 设置事件拦截,防止事件冒泡到下层元素(如 3D 引擎)
|
||||
*/
|
||||
private setupEventInterception;
|
||||
private updatePosition;
|
||||
@@ -45,6 +45,12 @@ declare class BimButtonGroup implements IBimComponent {
|
||||
render(): void;
|
||||
private renderGroup;
|
||||
private renderButton;
|
||||
/**
|
||||
* 设置按钮的激活状态
|
||||
* @param id 按钮 ID
|
||||
* @param active 可选,如果不传则切换(toggle)当前状态
|
||||
*/
|
||||
setBtnActive(id: string, active?: boolean): void;
|
||||
private handleClick;
|
||||
private handleMouseEnter;
|
||||
private handleMouseLeave;
|
||||
@@ -120,6 +126,21 @@ declare class BimDialog implements IBimComponent {
|
||||
* @param recenter 是否重新计算定位(例如保持居中),默认 true
|
||||
*/
|
||||
fitWidth(recenter?: boolean): void;
|
||||
/**
|
||||
* 根据内容自动调整弹窗高度
|
||||
*
|
||||
* 设计说明:
|
||||
* - 主要用于“内容展开/收起”场景(比如测量面板展开后,Dialog 高度跟随变化)
|
||||
* - 默认不改变用户拖拽后的当前位置,只做边界夹紧,避免弹窗超出容器
|
||||
*
|
||||
* @param recenter 是否根据 options.position 重新定位(默认 false)
|
||||
*/
|
||||
fitHeight(recenter?: boolean): void;
|
||||
/**
|
||||
* 边界夹紧:保持当前 left/top 不变的前提下,确保弹窗不超出容器
|
||||
* 说明:用于 fitHeight / fitWidth 后的“尺寸变化”场景,避免弹窗被裁切。
|
||||
*/
|
||||
private clampToContainer;
|
||||
/**
|
||||
* 初始化弹窗位置
|
||||
*/
|
||||
@@ -148,7 +169,7 @@ declare class BimDialog implements IBimComponent {
|
||||
}
|
||||
|
||||
export declare class BimEngine extends EventEmitter {
|
||||
private container;
|
||||
container: HTMLElement;
|
||||
private wrapper;
|
||||
toolbar: ToolbarManager | null;
|
||||
constructTreeBtn: ConstructTreeManagerBtn | null;
|
||||
@@ -157,6 +178,7 @@ export declare class BimEngine extends EventEmitter {
|
||||
engine: EngineManager | null;
|
||||
rightKey: RightKeyManager | null;
|
||||
propertyPanel: PropertyPanelManager | null;
|
||||
measure: MeasureDialogManager | null;
|
||||
constructor(container: HTMLElement | string, options?: {
|
||||
locale?: LocaleType;
|
||||
theme?: ThemeType;
|
||||
@@ -247,6 +269,7 @@ export declare interface ButtonConfig {
|
||||
label: string;
|
||||
icon?: string;
|
||||
keepActive?: boolean;
|
||||
isActive?: boolean;
|
||||
disabled?: boolean;
|
||||
onClick?: (button: OptButton) => void;
|
||||
children?: ButtonConfig[];
|
||||
@@ -657,6 +680,98 @@ declare type Listener<T = any> = (payload: T) => void;
|
||||
*/
|
||||
declare type LocaleType = 'zh-CN' | 'en-US';
|
||||
|
||||
/**
|
||||
* 测量弹窗管理器
|
||||
*/
|
||||
declare class MeasureDialogManager extends BimComponent {
|
||||
private dialogId;
|
||||
private dialog;
|
||||
private panel;
|
||||
constructor(engine: BimEngine);
|
||||
init(): void;
|
||||
/**
|
||||
* 显示测量弹窗
|
||||
*/
|
||||
show(): void;
|
||||
/**
|
||||
* 获取当前测量方式
|
||||
* 说明:如果面板未创建,则返回 null
|
||||
*/
|
||||
getActiveMode(): MeasureMode | null;
|
||||
/**
|
||||
* 切换测量方式(你要求的“切换类型的方法”)
|
||||
* @param mode 测量方式
|
||||
*/
|
||||
switchMode(mode: MeasureMode): void;
|
||||
/**
|
||||
* 设置测量结果(由外部注入,仅用于显示)
|
||||
* @param result 测量结果;传 null 表示清空
|
||||
*/
|
||||
setResult(result: MeasureResult | null): void;
|
||||
/**
|
||||
* 删除全部(仅清空 UI;真实测量清理逻辑后续再接)
|
||||
*/
|
||||
clearAll(): void;
|
||||
/**
|
||||
* 打开设置(仅预留方法/回调)
|
||||
*/
|
||||
openSettings(): void;
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 测量面板 - 类型定义
|
||||
*
|
||||
* 注意:
|
||||
* - 本次只实现 UI,不实现真实测量逻辑(拾取、画线、计算等)。
|
||||
* - 这里的类型以“可读性优先”为原则,尽量直观、易扩展。
|
||||
*/
|
||||
/**
|
||||
* 测量方式(8 种)
|
||||
*
|
||||
* 说明:
|
||||
* - id 采用英文驼峰/小写,便于程序内部使用;
|
||||
* - 显示名称必须通过国际化 key 获取(见 locales)。
|
||||
*/
|
||||
declare type MeasureMode = 'distance' | 'minDistance' | 'angle' | 'elevation' | 'volume' | 'laserDistance' | 'slope' | 'spaceVolume';
|
||||
|
||||
/**
|
||||
* 测量结果数据
|
||||
*
|
||||
* 说明:
|
||||
* - 真实测量未实现,因此结果由外部通过 setResult 传入。
|
||||
* - 不同测量方式对应不同字段;未传入则 UI 显示 “--”。
|
||||
*/
|
||||
declare interface MeasureResult {
|
||||
/** 距离(单位:mm) */
|
||||
distanceMm?: number;
|
||||
/** 最小距离(单位:mm) */
|
||||
minDistanceMm?: number;
|
||||
/** 角度(单位:deg) */
|
||||
angleDeg?: number;
|
||||
/** 标高(单位:mm) */
|
||||
elevationMm?: number;
|
||||
/** 体积(单位:m³) */
|
||||
volumeM3?: number;
|
||||
/** 激光测距(单位:mm) */
|
||||
laserDistanceMm?: number;
|
||||
/** 坡度(单位:%) */
|
||||
slopePercent?: number;
|
||||
/** 空间体积(单位:m³) */
|
||||
spaceVolumeM3?: number;
|
||||
/** 可选:展示测量点/结果点坐标(单位由引擎侧定义,这里只负责显示) */
|
||||
xyz?: MeasureXYZ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 3D 坐标(可选展示)
|
||||
*/
|
||||
declare interface MeasureXYZ {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单项配置接口 (用于简化的对象配置)
|
||||
*/
|
||||
@@ -815,6 +930,7 @@ declare class ToolbarManager extends BimComponent {
|
||||
addButton(config: ButtonConfig): void;
|
||||
setButtonVisibility(id: string, v: boolean): void;
|
||||
setShowLabel(show: boolean): void;
|
||||
setBtnActive(id: string, active?: boolean): void;
|
||||
setVisible(visible: boolean): void;
|
||||
setBackgroundColor(color: string): void;
|
||||
setColors(colors: ButtonGroupColors): void;
|
||||
|
||||
Reference in New Issue
Block a user