初始化

This commit is contained in:
yuding
2025-12-24 19:02:34 +08:00
parent 4b5eb78bbb
commit 04a5e74284
51 changed files with 8576 additions and 5334 deletions

View File

@@ -1,13 +1,21 @@
import { ButtonConfig } from '../../../index.type';
import type { ButtonConfig } from '../../../index.type';
import type { BimEngine } from '../../../../../bim-engine';
import { infoIcon } from './icon';
export const infoButton: ButtonConfig = {
id: 'toolbar-info',
type: 'button',
label: 'toolbar.info',
icon: infoIcon,
onClick: () => {
// WORKAROUND: Dispatch a standard custom event on document
document.dispatchEvent(new CustomEvent('bim-demo:open-property-panel'));
}
/**
* 信息按钮配置
* 说明:当前仍保留 demo 的事件触发方式engine 已注入,便于未来替换为 SDK 内部逻辑。
*/
export const createInfoButton = (_engine: BimEngine): ButtonConfig => {
return {
id: 'toolbar-info',
groupId: 'group-2',
type: 'button',
label: 'toolbar.info',
icon: infoIcon,
onClick: () => {
// WORKAROUND: Dispatch a standard custom event on document
document.dispatchEvent(new CustomEvent('bim-demo:open-property-panel'));
}
};
};

View File

@@ -1,16 +1,20 @@
import type { ButtonConfig } from '../../../index.type';
import type { BimEngine } from '../../../../../bim-engine';
/**
* 定位按钮配置
*/
export const locationButton: ButtonConfig = {
id: 'location',
groupId: 'group-1',
type: 'button',
label: 'toolbar.location',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M9 13h2v-2.75h2V13h2V8.25l-3-2l-3 2zm3 9q-4.025-3.425-6.012-6.362T4 10.2q0-3.75 2.413-5.975T12 2t5.588 2.225T20 10.2q0 2.5-1.987 5.438T12 22"/></svg>',
keepActive: false,
onClick: (button) => {
console.log('定位按钮被点击:', button.id);
}
export const createLocationButton = (_engine: BimEngine): ButtonConfig => {
return {
id: 'location',
groupId: 'group-1',
type: 'button',
label: 'toolbar.location',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M9 13h2v-2.75h2V13h2V8.25l-3-2l-3 2zm3 9q-4.025-3.425-6.012-6.362T4 10.2q0-3.75 2.413-5.975T12 2t5.588 2.225T20 10.2q0 2.5-1.987 5.438T12 22"/></svg>',
keepActive: false,
onClick: (button) => {
// 预留:未来接入定位逻辑(此处已注入 engine
console.log('定位按钮被点击:', button.id);
}
};
};

View File

@@ -0,0 +1,26 @@
import type { ButtonConfig } from '../../../../index.type';
import type { BimEngine } from '../../../../../../bim-engine';
/**
* 轴向剖切按钮配置
*/
export const createSectionAxisButton = (engine: BimEngine): ButtonConfig => {
return {
id: 'section-axis',
groupId: 'group-1',
parentId: 'section',
type: 'button',
keepActive: true,
exclusive: true,
align: 'vertical',
label: 'toolbar.sectionAxis',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><circle cx="12" cy="12" r="6" fill="currentColor"/></svg>',
onClick: (button) => {
if (button.isActive) {
engine.sectionAxis?.show();
} else {
engine.sectionAxis?.destroy();
}
}
};
};

View File

@@ -0,0 +1,29 @@
import type { ButtonConfig } from '../../../../index.type';
import type { BimEngine } from '../../../../../../bim-engine';
/**
* 剖切盒按钮配置
*/
export const createSectionBoxButton = (engine: BimEngine): ButtonConfig => {
return {
id: 'section-box',
groupId: 'group-1',
parentId: 'section',
type: 'button',
keepActive: true,
exclusive: true,
align: 'vertical',
label: 'toolbar.sectionBox',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><circle cx="12" cy="12" r="6" fill="currentColor"/></svg>',
onClick: (button) => {
console.log('剖切盒被点击:', button.id, '激活状态:', button.isActive);
if (button.isActive) {
// 激活时显示弹窗
engine.sectionBox?.show();
} else {
// 关闭时隐藏弹窗
engine.sectionBox?.hide();
}
}
};
};

View File

@@ -0,0 +1,20 @@
import type { ButtonConfig } from '../../../../index.type';
import type { BimEngine } from '../../../../../../bim-engine';
/**
* 剖切菜单按钮配置
*/
export const createSectionMenuButton = (_engine: BimEngine): ButtonConfig => {
return {
id: 'section',
groupId: 'group-1',
type: 'menu',
label: 'toolbar.section',
align: 'vertical',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><circle cx="12" cy="12" r="8" fill="currentColor"/></svg>',
keepActive: true,
onClick: (button) => {
console.log('剖切按钮被点击:', button.id);
}
};
};

View File

@@ -0,0 +1,29 @@
import type { ButtonConfig } from '../../../../index.type';
import type { BimEngine } from '../../../../../../bim-engine';
/**
* 拾取面剖切按钮配置
*/
export const createSectionPlaneButton = (engine: BimEngine): ButtonConfig => {
return {
id: 'section-plane',
groupId: 'group-1',
parentId: 'section',
type: 'button',
keepActive: true,
exclusive: true,
align: 'vertical',
label: 'toolbar.sectionPlane',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><circle cx="12" cy="12" r="6" fill="currentColor"/></svg>',
onClick: (button) => {
console.log('拾取面剖切被点击:', button.id, '激活状态:', button.isActive);
if (button.isActive) {
// 激活时显示弹窗
engine.sectionPlane?.show();
} else {
// 关闭时隐藏弹窗
engine.sectionPlane?.hide();
}
}
};
};

View File

@@ -1,16 +1,20 @@
import type { ButtonConfig } from '../../../index.type';
import type { BimEngine } from '../../../../../bim-engine';
/**
* 定位按钮配置
* 设置按钮配置
*/
export const settingButton: ButtonConfig = {
id: 'setting',
groupId: 'group-2',
type: 'button',
label: 'toolbar.setting',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="m9.25 22l-.4-3.2q-.325-.125-.612-.3t-.563-.375L4.7 19.375l-2.75-4.75l2.575-1.95Q4.5 12.5 4.5 12.338v-.675q0-.163.025-.338L1.95 9.375l2.75-4.75l2.975 1.25q.275-.2.575-.375t.6-.3l.4-3.2h5.5l.4 3.2q.325.125.613.3t.562.375l2.975-1.25l2.75 4.75l-2.575 1.95q.025.175.025.338v.674q0 .163-.05.338l2.575 1.95l-2.75 4.75l-2.95-1.25q-.275.2-.575.375t-.6.3l-.4 3.2zM11 20h1.975l.35-2.65q.775-.2 1.438-.587t1.212-.938l2.475 1.025l.975-1.7l-2.15-1.625q.125-.35.175-.737T17.5 12t-.05-.787t-.175-.738l2.15-1.625l-.975-1.7l-2.475 1.05q-.55-.575-1.212-.962t-1.438-.588L13 4h-1.975l-.35 2.65q-.775.2-1.437.588t-1.213.937L5.55 7.15l-.975 1.7l2.15 1.6q-.125.375-.175.75t-.05.8q0 .4.05.775t.175.75l-2.15 1.625l.975 1.7l2.475-1.05q.55.575 1.213.963t1.437.587zm1.05-4.5q1.45 0 2.475-1.025T15.55 12t-1.025-2.475T12.05 8.5q-1.475 0-2.488 1.025T8.55 12t1.013 2.475T12.05 15.5M12 12"/></svg>',
keepActive: false,
onClick: (button) => {
console.log('设置按钮被点击:', button.id);
}
export const createSettingButton = (_engine: BimEngine): ButtonConfig => {
return {
id: 'setting',
groupId: 'group-2',
type: 'button',
label: 'toolbar.setting',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="m9.25 22l-.4-3.2q-.325-.125-.612-.3t-.563-.375L4.7 19.375l-2.75-4.75l2.575-1.95Q4.5 12.5 4.5 12.338v-.675q0-.163.025-.338L1.95 9.375l2.75-4.75l2.975 1.25q.275-.2.575-.375t.6-.3l.4-3.2h5.5l.4 3.2q.325.125.613.3t.562.375l2.975-1.25l2.75 4.75l-2.575 1.95q.025.175.025.338v.674q0 .163-.05.338l2.575 1.95l-2.75 4.75l-2.95-1.25q-.275.2-.575.375t-.6.3l-.4 3.2zM11 20h1.975l.35-2.65q.775-.2 1.438-.587t1.212-.938l2.475 1.025l.975-1.7l-2.15-1.625q.125-.35.175-.737T17.5 12t-.05-.787t-.175-.738l2.15-1.625l-.975-1.7l-2.475 1.05q-.55-.575-1.212-.962t-1.438-.588L13 4h-1.975l-.35 2.65q-.775.2-1.437.588t-1.213.937L5.55 7.15l-.975 1.7l2.15 1.6q-.125.375-.175.75t-.05.8q0 .4.05.775t.175.75l-2.15 1.625l.975 1.7l2.475-1.05q.55.575 1.213.963t1.437.587zm1.05-4.5q1.45 0 2.475-1.025T15.55 12t-1.025-2.475T12.05 8.5q-1.475 0-2.488 1.025T8.55 12t1.013 2.475T12.05 15.5M12 12"/></svg>',
keepActive: false,
onClick: (button) => {
// 预留:未来接入设置逻辑(此处已注入 engine
console.log('设置按钮被点击:', button.id);
}
};
};

View File

@@ -1,14 +1,22 @@
import type { ButtonConfig } from '../../../../index.type';
import type { BimEngine } from '../../../../../../bim-engine';
export const walkBirdButton: ButtonConfig = {
id: 'walk-bird',
groupId: 'group-1',
parentId: 'walk',
align: 'vertical',
type: 'button',
label: 'toolbar.walkBird',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M9 22V8.775q-2.275-.6-3.637-2.512T4 2h2q0 2.075 1.338 3.538T10.75 7h2.5q.75 0 1.4.275t1.175.8L20.35 12.6l-1.4 1.4L15 10.05V22h-2v-6h-2v6zm3-16q-.825 0-1.412-.587T10 4t.588-1.412T12 2t1.413.588T14 4t-.587 1.413T12 6"/></svg>',
onClick: (button) => {
console.log('鸟瞰漫游被点击:', button.id);
}
/**
* 第三人称(鸟瞰)漫游按钮配置
*/
export const createWalkBirdButton = (_engine: BimEngine): ButtonConfig => {
return {
id: 'walk-bird',
groupId: 'group-1',
parentId: 'walk',
align: 'vertical',
keepActive: true,
exclusive: true,
type: 'button',
label: 'toolbar.walkBird',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M9 22V8.775q-2.275-.6-3.637-2.512T4 2h2q0 2.075 1.338 3.538T10.75 7h2.5q.75 0 1.4.275t1.175.8L20.35 12.6l-1.4 1.4L15 10.05V22h-2v-6h-2v6zm3-16q-.825 0-1.412-.587T10 4t.588-1.412T12 2t1.413.588T14 4t-.587 1.413T12 6"/></svg>',
onClick: (button) => {
console.log('鸟瞰漫游被点击:', button.id);
}
};
};

View File

@@ -1,17 +1,20 @@
import type { ButtonConfig } from '../../../../index.type';
import type { BimEngine } from '../../../../../../bim-engine';
/**
* 漫游菜单按钮配置
*/
export const walkMenuButton: ButtonConfig = {
id: 'walk',
groupId: 'group-1',
type: 'menu',
label: 'toolbar.walk',
align: 'vertical',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M9 22V8.775q-2.275-.6-3.637-2.512T4 2h2q0 2.075 1.338 3.538T10.75 7h2.5q.75 0 1.4.275t1.175.8L20.35 12.6l-1.4 1.4L15 10.05V22h-2v-6h-2v6zm3-16q-.825 0-1.412-.587T10 4t.588-1.412T12 2t1.413.588T14 4t-.587 1.413T12 6"/></svg>',
keepActive: true,
onClick: (button) => {
console.log('漫游按钮被点击:', button.id);
}
export const createWalkMenuButton = (_engine: BimEngine): ButtonConfig => {
return {
id: 'walk',
groupId: 'group-1',
type: 'menu',
label: 'toolbar.walk',
align: 'vertical',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M9 22V8.775q-2.275-.6-3.637-2.512T4 2h2q0 2.075 1.338 3.538T10.75 7h2.5q.75 0 1.4.275t1.175.8L20.35 12.6l-1.4 1.4L15 10.05V22h-2v-6h-2v6zm3-16q-.825 0-1.412-.587T10 4t.588-1.412T12 2t1.413.588T14 4t-.587 1.413T12 6"/></svg>',
keepActive: true,
onClick: (button) => {
console.log('漫游按钮被点击:', button.id);
}
};
};

View File

@@ -1,14 +1,22 @@
import type { ButtonConfig } from '../../../../index.type';
import type { BimEngine } from '../../../../../../bim-engine';
export const walkPersonButton: ButtonConfig = {
id: 'walk-person',
groupId: 'group-1',
parentId: 'walk',
type: 'button',
align: 'vertical',
label: 'toolbar.walkPerson',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M9 22V8.775q-2.275-.6-3.637-2.512T4 2h2q0 2.075 1.338 3.538T10.75 7h2.5q.75 0 1.4.275t1.175.8L20.35 12.6l-1.4 1.4L15 10.05V22h-2v-6h-2v6zm3-16q-.825 0-1.412-.587T10 4t.588-1.412T12 2t1.413.588T14 4t-.587 1.413T12 6"/></svg>',
onClick: (button) => {
console.log('人视漫游被点击:', button.id);
}
/**
* 第一人称漫游按钮配置
*/
export const createWalkPersonButton = (_engine: BimEngine): ButtonConfig => {
return {
id: 'walk-person',
groupId: 'group-1',
parentId: 'walk',
type: 'button',
keepActive: true,
exclusive: true,
align: 'vertical',
label: 'toolbar.walkPerson',
icon: '<svg width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M9 22V8.775q-2.275-.6-3.637-2.512T4 2h2q0 2.075 1.338 3.538T10.75 7h2.5q.75 0 1.4.275t1.175.8L20.35 12.6l-1.4 1.4L15 10.05V22h-2v-6h-2v6zm3-16q-.825 0-1.412-.587T10 4t.588-1.412T12 2t1.413.588T14 4t-.587 1.413T12 6"/></svg>',
onClick: (button) => {
console.log('人视漫游被点击:', button.id);
}
};
};

View File

@@ -0,0 +1,26 @@
import type { ButtonConfig } from '../../../index.type';
import type { BimEngine } from '../../../../../bim-engine';
/**
* 选框放大按钮配置
*
* 说明:
* - 当前仅添加 UI 按钮,点击事件先留空(后续接入引擎能力再实现)
* - 使用工厂函数模式注入 engine便于未来调用 engine API
*/
export const createZoomBoxButton = (_engine: BimEngine): ButtonConfig => {
return {
id: 'zoom-box',
groupId: 'group-1',
keepActive: true,
type: 'button',
label: 'toolbar.zoomBox',
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M16.5 20q-1.875 0-3.187-1.312T12 15.5t1.313-3.187T16.5 11t3.188 1.313T21 15.5q0 .65-.187 1.25T20.3 17.9l2 2q.275.275.275.7t-.275.7t-.7.275t-.7-.275l-2-2q-.55.325-1.15.513T16.5 20m0-2q1.05 0 1.775-.725T19 15.5t-.725-1.775T16.5 13t-1.775.725T14 15.5t.725 1.775T16.5 18M4 18V9v1v-4zm0 2q-.825 0-1.412-.587T2 18V6q0-.825.588-1.412T4 4h16q.825 0 1.413.588T22 6v3q0 .425-.288.713T21 10h-8V6H4v12h5q.425 0 .713.288T10 19t-.288.713T9 20z"/></svg>',
onClick: () => {
// 事件先留空:后续实现“框选放大/框选缩放”能力时再接入
// 这里不做任何动作,避免误触影响用户操作
}
};
};