2025-12-03 18:35:05 +08:00
|
|
|
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode('.bim-engine-wrapper{position:relative;width:100%;height:100%;font-family:sans-serif;color:#333;padding:20px;background-color:#e16969;border-radius:8px;border:1px solid #e0e0e0;box-sizing:border-box}.bim-engine-opt-btn-container{position:absolute;bottom:20px;left:50%;transform:translate(-50%);z-index:100}:root{--bim-toolbar-bg: rgba(17, 17, 17, .88);--bim-btn-bg: transparent;--bim-btn-hover-bg: #444;--bim-btn-active-bg: rgba(255, 255, 255, .15);--bim-icon-color: #ccc;--bim-icon-active-color: #fff;--bim-btn-text-color: #ccc;--bim-btn-text-active-color: #fff}.toolbar-container{display:flex;align-items:center;max-width:100%;overflow-x:auto;scrollbar-width:none;-ms-overflow-style:none}.toolbar-container::-webkit-scrollbar{display:none}.opt-btn-group{overflow:hidden;display:flex;align-items:center;flex-shrink:0;background-color:var(--bim-toolbar-bg);border-radius:4px;padding:4px 8px}.has-divider{margin-right:16px}.opt-btn-wrapper{position:relative}.opt-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;width:50px;min-height:50px;padding:4px;cursor:pointer;background-color:var(--bim-btn-bg);color:var(--bim-icon-color);transition:all .2s;border-bottom:2px solid transparent}.opt-btn:hover{background-color:var(--bim-btn-hover-bg);color:var(--bim-icon-active-color)}.opt-btn.active{background-color:var(--bim-btn-active-bg);color:var(--bim-icon-active-color);border-bottom:2px solid #fff}.opt-btn.disabled{opacity:.5;cursor:not-allowed}.opt-btn-icon{width:32px;height:32px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.opt-btn-icon svg{width:100%;height:100%}.opt-btn-label{font-size:10px;margin-top:2px;color:var(--bim-btn-text-color)}.opt-btn:hover .opt-btn-label,.opt-btn.active .opt-btn-label{color:var(--bim-btn-text-active-color)}.opt-btn-arrow{font-size:8px;position:absolute;top:2px;right:2px;opacity:.6;transition:transform .2s ease}.opt-btn-arrow.rotated{transform:rotate(180deg)}.opt-btn.no-label .opt-btn-arrow{top:2px;right:2px}.opt-btn-dropdown{position:fixed;transform:translate(-50%,-100%);background-color:var(--bim-toolbar-bg);border-radius:4px;overflow:hidden;box-shadow:0 4px 12px #0000004d;min-width:50px;z-index:9999;display:flex;flex-direction:column}.opt-btn-dropdown-item{display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--bim-icon-color);cursor:pointer;transition:background .2s;white-space:nowrap;min-width:50px;min-height:50px;padding:4px;background-color:var(--bim-btn-bg)}.opt-btn-dropdown-item:hover{background-color:var(--bim-btn-hover-bg);color:var(--bim-icon-active-color)}.opt-btn-dropdown-item .opt-btn-icon.small{width:30px;height:30px;margin-right:0;margin-bottom:4px}.opt-btn-dropdown-item span{font-size:10px;color:var(--bim-btn-text-color)}.opt-btn-dropdown-item:hover span{color:var(--bim-btn-text-active-color)}.opt-btn.no-label .opt-btn-icon{width:32px;height:32px}:root{--bim-dialog-bg: rgba(17, 17, 17, .95);--bim-dialog-header-bg: #2a2a2a;--bim-dialog-title-color: #fff;--bim-dialog-text-color: #ccc;--bim-dialog-border-color: #444}.bim-dialog{position:absolute;background-color:var(--bim-dialog-bg);border:1px solid var(--bim-dialog-border-color);border-radius:6px;box-shadow:0 4px 12px #0000004d;display:flex;flex-direction:column;z-index:1000;color:var(--bim-dialog-title-color);overflow:hidden;min-width:200px;min-height:100px}.bim-dialog-header{height:32px;background-color:var(--bim-dialog-header-bg);display:flex;align-items:center;justify-content:space-between;padding:0 10px;cursor:default;-webkit-user-select:none;user-select:none;border-bottom:1px solid var(--bim-dialog-border-color);flex-shrink:0}.bim-dialog-header.draggable{cursor:move}.bim-dialog-title{font-size:14px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--bim-dialog-title-color)}.bim-dialog-close{cursor:pointer;font-size:18px;color:#999;line-height:1;margin-left:8px}.bim-dialog-close:hover{color:#fff
|
|
|
|
|
|
class f {
|
|
|
|
|
|
/** 挂载容器 */
|
2025-12-03 12:00:46 +08:00
|
|
|
|
container;
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/** 组件配置选项 */
|
2025-12-03 15:46:18 +08:00
|
|
|
|
options;
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/** 按钮组列表,按顺序存储 */
|
2025-12-03 15:46:18 +08:00
|
|
|
|
groups = [];
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/** 当前处于激活状态的按钮 ID 集合 */
|
2025-12-03 15:46:18 +08:00
|
|
|
|
activeBtnIds = /* @__PURE__ */ new Set();
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/** 按钮 DOM 元素的引用映射,方便快速查找 */
|
2025-12-03 15:46:18 +08:00
|
|
|
|
btnRefs = /* @__PURE__ */ new Map();
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/** 当<><E5BD93>显示的下拉菜单元素 */
|
2025-12-03 15:46:18 +08:00
|
|
|
|
dropdownElement = null;
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/** 鼠标悬停计时器,用于处理菜单显示的防抖 */
|
2025-12-03 15:46:18 +08:00
|
|
|
|
hoverTimeout = null;
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/** 默认图标 SVG */
|
2025-12-03 15:46:18 +08:00
|
|
|
|
DEFAULT_ICON = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect></svg>';
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 构造函数
|
|
|
|
|
|
* @param options 配置选项
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
constructor(t) {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
const o = typeof t.container == "string" ? document.getElementById(t.container) : t.container;
|
|
|
|
|
|
if (!o) throw new Error("Container not found");
|
|
|
|
|
|
this.container = o, this.options = {
|
2025-12-03 15:46:18 +08:00
|
|
|
|
showLabel: !0,
|
|
|
|
|
|
visibility: {},
|
|
|
|
|
|
...t
|
2025-12-03 18:35:05 +08:00
|
|
|
|
}, this.initContainer(), this.applyStyles();
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 初始化容器
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
initContainer() {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
this.container.innerHTML = "", this.container.classList.add("toolbar-root");
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 应用样式配置到 CSS 变量
|
|
|
|
|
|
*/
|
|
|
|
|
|
applyStyles() {
|
|
|
|
|
|
const t = this.container.style;
|
|
|
|
|
|
this.options.backgroundColor && t.setProperty("--bim-toolbar-bg", this.options.backgroundColor), this.options.btnBackgroundColor && t.setProperty("--bim-btn-bg", this.options.btnBackgroundColor), this.options.btnHoverColor && t.setProperty("--bim-btn-hover-bg", this.options.btnHoverColor), this.options.btnActiveColor && t.setProperty("--bim-btn-active-bg", this.options.btnActiveColor), this.options.iconColor && t.setProperty("--bim-icon-color", this.options.iconColor), this.options.iconActiveColor && t.setProperty("--bim-icon-active-color", this.options.iconActiveColor), this.options.textColor && t.setProperty("--bim-btn-text-color", this.options.textColor), this.options.textActiveColor && t.setProperty("--bim-btn-text-active-color", this.options.textActiveColor);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 更新颜色配置
|
|
|
|
|
|
* @param colors 颜色配置对象
|
|
|
|
|
|
*/
|
|
|
|
|
|
setColors(t) {
|
|
|
|
|
|
this.options = { ...this.options, ...t }, this.applyStyles();
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 添加按钮组
|
|
|
|
|
|
* @param groupId 组ID
|
2025-12-03 18:35:05 +08:00
|
|
|
|
* @param beforeGroupId 在哪个组之前插入(可选<EFBFBD><EFBFBD><EFBFBD>,不传则插入到最后
|
2025-12-03 15:46:18 +08:00
|
|
|
|
*/
|
2025-12-03 18:35:05 +08:00
|
|
|
|
addGroup(t, o) {
|
|
|
|
|
|
if (this.groups.some((i) => i.id === t)) {
|
2025-12-03 15:46:18 +08:00
|
|
|
|
console.warn("Group " + t + " already exists");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
const e = { id: t, buttons: [] };
|
|
|
|
|
|
if (o) {
|
|
|
|
|
|
const i = this.groups.findIndex((n) => n.id === o);
|
|
|
|
|
|
i !== -1 ? this.groups.splice(i, 0, e) : (console.warn(`Target group ${o} not found, appending ${t} to end.`), this.groups.push(e));
|
2025-12-03 15:46:18 +08:00
|
|
|
|
} else
|
2025-12-03 18:35:05 +08:00
|
|
|
|
this.groups.push(e);
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
/**
|
2025-12-03 18:35:05 +08:00
|
|
|
|
* 添加按钮到指定组
|
2025-12-03 15:46:18 +08:00
|
|
|
|
* @param config 按钮配置(必须包含 groupId,可选包含 parentId)
|
|
|
|
|
|
*/
|
|
|
|
|
|
addButton(t) {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
const { groupId: o, parentId: e } = t;
|
|
|
|
|
|
if (!o)
|
2025-12-03 15:46:18 +08:00
|
|
|
|
throw new Error(`Button ${t.id} config must contain 'groupId'`);
|
2025-12-03 18:35:05 +08:00
|
|
|
|
const i = this.groups.find((s) => s.id === o);
|
|
|
|
|
|
if (!i)
|
|
|
|
|
|
throw new Error(`Group ${o} not found. Please call addGroup first.`);
|
|
|
|
|
|
const n = {
|
2025-12-03 15:46:18 +08:00
|
|
|
|
...t,
|
|
|
|
|
|
children: t.children || []
|
|
|
|
|
|
};
|
2025-12-03 18:35:05 +08:00
|
|
|
|
if (e) {
|
|
|
|
|
|
const s = this.findButton(i.buttons, e);
|
|
|
|
|
|
if (!s)
|
|
|
|
|
|
throw new Error(`Parent button ${e} not found in group ${o}`);
|
|
|
|
|
|
s.children || (s.children = []), s.children.push(n);
|
2025-12-03 15:46:18 +08:00
|
|
|
|
} else
|
2025-12-03 18:35:05 +08:00
|
|
|
|
i.buttons.push(n);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 递归查找按钮
|
|
|
|
|
|
*/
|
|
|
|
|
|
findButton(t, o) {
|
|
|
|
|
|
for (const e of t) {
|
|
|
|
|
|
if (e.id === o) return e;
|
|
|
|
|
|
if (e.children) {
|
|
|
|
|
|
const i = this.findButton(e.children, o);
|
|
|
|
|
|
if (i) return i;
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 初始化组件,加载默认按钮配置
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
async init() {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
const { homeButton: t } = await import("./index-CAJWny5G.mjs"), { locationButton: o } = await import("./index-C12x1apF.mjs"), { walkMenuButton: e } = await import("./index-Wpi9Br9A.mjs"), { walkPersonButton: i } = await import("./index-BXbORK0j.mjs"), { walkBirdButton: n } = await import("./index-Djlk5GIH.mjs"), { settingButton: s } = await import("./index-DsRG5l_h.mjs"), { infoButton: r } = await import("./index-DvZ5eiUH.mjs");
|
|
|
|
|
|
this.addGroup("group-1"), this.addButton(t), this.addButton(e), this.addButton(i), this.addButton(n), this.addButton(o), this.addGroup("group-2"), this.addButton(s), this.addButton(r), this.render();
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 渲染整个工具栏
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
render() {
|
|
|
|
|
|
this.container.innerHTML = "", this.btnRefs.clear();
|
|
|
|
|
|
const t = document.createElement("div");
|
2025-12-03 18:35:05 +08:00
|
|
|
|
t.className = "toolbar-container", this.groups.forEach((o, e) => {
|
|
|
|
|
|
const i = this.renderGroup(o, e, this.groups.length);
|
|
|
|
|
|
t.appendChild(i);
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}), this.container.appendChild(t);
|
|
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 渲染单个按钮组
|
|
|
|
|
|
*/
|
|
|
|
|
|
renderGroup(t, o, e) {
|
|
|
|
|
|
const i = document.createElement("div");
|
|
|
|
|
|
return i.className = "opt-btn-group", o < e - 1 && i.classList.add("has-divider"), t.buttons.forEach((n) => {
|
|
|
|
|
|
if (this.isVisible(n.id)) {
|
|
|
|
|
|
const s = this.renderButton(n);
|
|
|
|
|
|
i.appendChild(s);
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
}), i;
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 渲染单个按钮
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
renderButton(t) {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
const o = document.createElement("div");
|
|
|
|
|
|
o.className = "opt-btn-wrapper";
|
2025-12-03 15:46:18 +08:00
|
|
|
|
const e = document.createElement("div");
|
2025-12-03 18:35:05 +08:00
|
|
|
|
e.className = "opt-btn", this.activeBtnIds.has(t.id) && e.classList.add("active"), t.disabled && e.classList.add("disabled"), this.options.showLabel || (e.classList.add("no-label"), t.label && (e.title = t.label));
|
2025-12-03 15:46:18 +08:00
|
|
|
|
const i = document.createElement("div");
|
2025-12-03 18:35:05 +08:00
|
|
|
|
if (i.className = "opt-btn-icon", i.innerHTML = this.getIcon(t.icon), e.appendChild(i), this.options.showLabel && t.label) {
|
|
|
|
|
|
const n = document.createElement("span");
|
|
|
|
|
|
n.className = "opt-btn-label", n.textContent = t.label, e.appendChild(n);
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (t.children && t.children.length > 0) {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
const n = document.createElement("span");
|
|
|
|
|
|
n.className = "opt-btn-arrow", n.textContent = "▼", e.appendChild(n);
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
return e.addEventListener("click", () => this.handleClick(t)), e.addEventListener("mouseenter", () => this.handleMouseEnter(t, e)), e.addEventListener("mouseleave", () => this.handleMouseLeave()), this.btnRefs.set(t.id, e), o.appendChild(e), o;
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 处理按钮点击事件
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
handleClick(t) {
|
|
|
|
|
|
t.disabled || (!t.children || t.children.length === 0) && (t.keepActive && (this.activeBtnIds.has(t.id) ? this.activeBtnIds.delete(t.id) : this.activeBtnIds.add(t.id), this.updateButtonState(t.id)), this.closeDropdown(), t.onClick && t.onClick(t));
|
|
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 处理子菜单项点击事件
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
handleSubClick(t) {
|
|
|
|
|
|
t.keepActive && (this.activeBtnIds.has(t.id) ? this.activeBtnIds.delete(t.id) : this.activeBtnIds.add(t.id), this.updateButtonState(t.id)), this.closeDropdown(), t.onClick && t.onClick(t);
|
|
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 处理鼠标移入事件(显示菜单)
|
|
|
|
|
|
*/
|
|
|
|
|
|
handleMouseEnter(t, o) {
|
2025-12-03 15:46:18 +08:00
|
|
|
|
if (this.hoverTimeout && (clearTimeout(this.hoverTimeout), this.hoverTimeout = null), t.children && t.children.length > 0) {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
this.showDropdown(t, o);
|
|
|
|
|
|
const e = o.querySelector(".opt-btn-arrow");
|
|
|
|
|
|
e && e.classList.add("rotated");
|
2025-12-03 15:46:18 +08:00
|
|
|
|
} else
|
|
|
|
|
|
this.closeDropdown();
|
|
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 处理鼠标移出事件(隐藏菜单)
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
handleMouseLeave() {
|
|
|
|
|
|
this.hoverTimeout = window.setTimeout(() => {
|
|
|
|
|
|
this.closeDropdown();
|
|
|
|
|
|
}, 200);
|
|
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 显示下拉菜单
|
|
|
|
|
|
*/
|
|
|
|
|
|
showDropdown(t, o) {
|
2025-12-03 15:46:18 +08:00
|
|
|
|
if (this.closeDropdown(), !t.children) return;
|
2025-12-03 18:35:05 +08:00
|
|
|
|
const e = document.createElement("div");
|
|
|
|
|
|
e.className = "opt-btn-dropdown";
|
|
|
|
|
|
const i = e.style;
|
|
|
|
|
|
this.options.backgroundColor && i.setProperty("--bim-toolbar-bg", this.options.backgroundColor), this.options.btnBackgroundColor && i.setProperty("--bim-btn-bg", this.options.btnBackgroundColor), this.options.btnHoverColor && i.setProperty("--bim-btn-hover-bg", this.options.btnHoverColor), this.options.btnActiveColor && i.setProperty("--bim-btn-active-bg", this.options.btnActiveColor), this.options.iconColor && i.setProperty("--bim-icon-color", this.options.iconColor), this.options.iconActiveColor && i.setProperty("--bim-icon-active-color", this.options.iconActiveColor), this.options.textColor && i.setProperty("--bim-btn-text-color", this.options.textColor), this.options.textActiveColor && i.setProperty("--bim-btn-text-active-color", this.options.textActiveColor);
|
|
|
|
|
|
const n = o.getBoundingClientRect(), s = n.left + n.width / 2;
|
|
|
|
|
|
e.style.top = n.top - 8 + "px", e.style.left = s + "px", t.children.forEach((r) => {
|
|
|
|
|
|
if (this.isVisible(r.id)) {
|
|
|
|
|
|
const a = this.renderDropdownItem(r);
|
|
|
|
|
|
e.appendChild(a);
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
}), e.addEventListener("mouseenter", () => {
|
2025-12-03 15:46:18 +08:00
|
|
|
|
this.hoverTimeout && (clearTimeout(this.hoverTimeout), this.hoverTimeout = null);
|
2025-12-03 18:35:05 +08:00
|
|
|
|
}), e.addEventListener("mouseleave", () => this.handleMouseLeave()), document.body.appendChild(e), this.dropdownElement = e;
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 渲染下拉菜单项
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
renderDropdownItem(t) {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
const o = document.createElement("div");
|
|
|
|
|
|
o.className = "opt-btn-dropdown-item";
|
2025-12-03 15:46:18 +08:00
|
|
|
|
const e = document.createElement("div");
|
2025-12-03 18:35:05 +08:00
|
|
|
|
if (e.className = "opt-btn-icon small", e.innerHTML = this.getIcon(t.icon), o.appendChild(e), this.options.showLabel) {
|
|
|
|
|
|
const i = document.createElement("span");
|
|
|
|
|
|
i.textContent = t.label, o.appendChild(i);
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
return o.addEventListener("click", (i) => {
|
|
|
|
|
|
i.stopPropagation(), this.handleSubClick(t);
|
|
|
|
|
|
}), o;
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 关闭所有下拉菜单
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
closeDropdown() {
|
|
|
|
|
|
this.dropdownElement && (this.dropdownElement.remove(), this.dropdownElement = null), this.btnRefs.forEach((t) => {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
const o = t.querySelector(".opt-btn-arrow");
|
|
|
|
|
|
o && o.classList.remove("rotated");
|
2025-12-03 15:46:18 +08:00
|
|
|
|
});
|
|
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 更新按钮的激活状态样式
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
updateButtonState(t) {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
const o = this.btnRefs.get(t);
|
|
|
|
|
|
o && (this.activeBtnIds.has(t) ? o.classList.add("active") : o.classList.remove("active"));
|
2025-12-03 15:46:18 +08:00
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 获取图标 SVG 字符串
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
getIcon(t) {
|
|
|
|
|
|
return t || this.DEFAULT_ICON;
|
|
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 更新按钮可见性
|
|
|
|
|
|
* @param buttonId 按钮ID
|
|
|
|
|
|
* @param visible 是否可见
|
|
|
|
|
|
*/
|
|
|
|
|
|
updateButtonVisibility(t, o) {
|
|
|
|
|
|
this.options.visibility || (this.options.visibility = {}), this.options.visibility[t] = o, this.render();
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 设置是否显示标签
|
|
|
|
|
|
* @param show 是否显示
|
|
|
|
|
|
*/
|
|
|
|
|
|
setShowLabel(t) {
|
|
|
|
|
|
this.options.showLabel = t, this.render();
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 设置背景颜色 (兼容旧接口)
|
|
|
|
|
|
* @param color CSS 颜色值
|
|
|
|
|
|
*/
|
|
|
|
|
|
setBackgroundColor(t) {
|
|
|
|
|
|
this.setColors({ backgroundColor: t });
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 检查按钮是否可见
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
isVisible(t) {
|
|
|
|
|
|
return this.options.visibility?.[t] !== !1;
|
|
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 销毁组件,清理资源
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
destroy() {
|
|
|
|
|
|
this.closeDropdown(), this.hoverTimeout && clearTimeout(this.hoverTimeout), this.container.innerHTML = "", this.btnRefs.clear(), this.activeBtnIds.clear(), this.groups = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
class g {
|
|
|
|
|
|
/** 内部工具栏组件实例 */
|
2025-12-03 15:46:18 +08:00
|
|
|
|
optBtnGroups = null;
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/** 工具栏挂载的容器 */
|
|
|
|
|
|
container;
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 构造函数
|
|
|
|
|
|
* @param container 工具栏挂载的容器元素
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
constructor(t) {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
this.container = t, this.init();
|
2025-12-03 12:00:46 +08:00
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 初始化工具栏
|
|
|
|
|
|
*/
|
2025-12-03 12:00:46 +08:00
|
|
|
|
init() {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
this.optBtnGroups = new f({
|
|
|
|
|
|
container: this.container,
|
|
|
|
|
|
showLabel: !0
|
|
|
|
|
|
}), this.optBtnGroups.init().catch((t) => {
|
|
|
|
|
|
console.error("Failed to initialize OptBtnGroups:", t);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 添加一个工具栏按钮组
|
|
|
|
|
|
* @param groupId 新组的 ID
|
|
|
|
|
|
* @param beforeGroupId (可选) 插入到哪个组之前,不传则追加到最后
|
|
|
|
|
|
*/
|
|
|
|
|
|
addGroup(t, o) {
|
|
|
|
|
|
this.optBtnGroups ? (this.optBtnGroups.addGroup(t, o), this.optBtnGroups.render()) : console.warn("Toolbar not initialized yet.");
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 添加一个工具栏按钮
|
|
|
|
|
|
* @param config 按钮配置对象
|
|
|
|
|
|
*/
|
|
|
|
|
|
addButton(t) {
|
|
|
|
|
|
this.optBtnGroups ? (this.optBtnGroups.addButton(t), this.optBtnGroups.render()) : console.warn("Toolbar not initialized yet.");
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 设置按钮的可见性
|
|
|
|
|
|
* @param buttonId 按钮 ID
|
|
|
|
|
|
* @param visible 是否可见
|
|
|
|
|
|
*/
|
|
|
|
|
|
setButtonVisibility(t, o) {
|
|
|
|
|
|
this.optBtnGroups ? this.optBtnGroups.updateButtonVisibility(t, o) : console.warn("Toolbar not initialized yet.");
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 设置是否显示按钮下方的文字标签
|
|
|
|
|
|
* @param show 是否显示
|
|
|
|
|
|
*/
|
|
|
|
|
|
setShowLabel(t) {
|
|
|
|
|
|
this.optBtnGroups ? this.optBtnGroups.setShowLabel(t) : console.warn("Toolbar not initialized yet.");
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 设置整个工具栏的可见性
|
|
|
|
|
|
* @param visible 是否可见
|
|
|
|
|
|
*/
|
|
|
|
|
|
setVisible(t) {
|
|
|
|
|
|
this.container.style.display = t ? "block" : "none";
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 设置工具栏背景颜色
|
|
|
|
|
|
* @param color CSS 颜色值
|
|
|
|
|
|
*/
|
|
|
|
|
|
setBackgroundColor(t) {
|
|
|
|
|
|
this.optBtnGroups ? this.optBtnGroups.setBackgroundColor(t) : console.warn("Toolbar not initialized yet.");
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 设置工具栏详细颜色配置
|
|
|
|
|
|
* @param colors 颜色配置对象
|
|
|
|
|
|
*/
|
|
|
|
|
|
setColors(t) {
|
|
|
|
|
|
this.optBtnGroups ? this.optBtnGroups.setColors(t) : console.warn("Toolbar not initialized yet.");
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 销毁工具栏管理器
|
|
|
|
|
|
*/
|
|
|
|
|
|
destroy() {
|
|
|
|
|
|
this.optBtnGroups && (this.optBtnGroups.destroy(), this.optBtnGroups = null);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
class u {
|
|
|
|
|
|
element;
|
|
|
|
|
|
options;
|
|
|
|
|
|
container;
|
|
|
|
|
|
header;
|
|
|
|
|
|
contentArea;
|
|
|
|
|
|
_isDestroyed = !1;
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 构造函数
|
|
|
|
|
|
* @param options 弹窗配置选项
|
|
|
|
|
|
*/
|
|
|
|
|
|
constructor(t) {
|
|
|
|
|
|
this.options = {
|
|
|
|
|
|
title: "Dialog",
|
|
|
|
|
|
width: 300,
|
|
|
|
|
|
height: "auto",
|
|
|
|
|
|
position: "center",
|
|
|
|
|
|
draggable: !0,
|
|
|
|
|
|
resizable: !1,
|
|
|
|
|
|
minWidth: 200,
|
|
|
|
|
|
minHeight: 100,
|
|
|
|
|
|
...t
|
|
|
|
|
|
}, this.container = t.container, this.element = this.createDom(), this.header = this.element.querySelector(".bim-dialog-header"), this.contentArea = this.element.querySelector(".bim-dialog-content"), this.init();
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 创建弹窗的 DOM 结构
|
|
|
|
|
|
*/
|
|
|
|
|
|
createDom() {
|
2025-12-03 15:46:18 +08:00
|
|
|
|
const t = document.createElement("div");
|
2025-12-03 18:35:05 +08:00
|
|
|
|
t.className = "bim-dialog", this.options.id && (t.id = this.options.id);
|
|
|
|
|
|
const o = t.style;
|
|
|
|
|
|
this.options.backgroundColor && o.setProperty("--bim-dialog-bg", this.options.backgroundColor), this.options.headerBackgroundColor && o.setProperty("--bim-dialog-header-bg", this.options.headerBackgroundColor), this.options.titleColor && o.setProperty("--bim-dialog-title-color", this.options.titleColor), this.options.textColor && o.setProperty("--bim-dialog-text-color", this.options.textColor), this.options.borderColor && o.setProperty("--bim-dialog-border-color", this.options.borderColor), this.setSize(t, this.options.width, this.options.height);
|
|
|
|
|
|
const e = document.createElement("div");
|
|
|
|
|
|
e.className = "bim-dialog-header", this.options.draggable && e.classList.add("draggable");
|
|
|
|
|
|
const i = document.createElement("span");
|
|
|
|
|
|
i.className = "bim-dialog-title", i.textContent = this.options.title || "";
|
|
|
|
|
|
const n = document.createElement("span");
|
|
|
|
|
|
n.className = "bim-dialog-close", n.innerHTML = "×", n.onclick = () => this.close(), e.appendChild(i), e.appendChild(n);
|
|
|
|
|
|
const s = document.createElement("div");
|
|
|
|
|
|
if (s.className = "bim-dialog-content", typeof this.options.content == "string" ? s.innerHTML = this.options.content : this.options.content instanceof HTMLElement && s.appendChild(this.options.content), t.appendChild(e), t.appendChild(s), this.options.resizable) {
|
|
|
|
|
|
const r = document.createElement("div");
|
|
|
|
|
|
r.className = "bim-dialog-resize-handle", t.appendChild(r);
|
|
|
|
|
|
}
|
|
|
|
|
|
return t;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 设置元素尺寸
|
|
|
|
|
|
*/
|
|
|
|
|
|
setSize(t, o, e) {
|
|
|
|
|
|
o !== void 0 && (t.style.width = typeof o == "number" ? `${o}px` : o), e !== void 0 && (t.style.height = typeof e == "number" ? `${e}px` : e);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 初始化组件功能
|
|
|
|
|
|
*/
|
|
|
|
|
|
init() {
|
|
|
|
|
|
this.container.appendChild(this.element), this.initPosition(), this.options.draggable && this.initDrag(), this.options.resizable && this.initResize();
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 初始化弹窗位置
|
|
|
|
|
|
*/
|
|
|
|
|
|
initPosition() {
|
|
|
|
|
|
const t = this.options.position, o = this.element.getBoundingClientRect();
|
|
|
|
|
|
let e = 0, i = 0;
|
|
|
|
|
|
const n = this.container.clientWidth, s = this.container.clientHeight, r = o.width, a = o.height;
|
|
|
|
|
|
if (typeof t == "object" && "x" in t)
|
|
|
|
|
|
e = t.x, i = t.y;
|
|
|
|
|
|
else
|
|
|
|
|
|
switch (t) {
|
|
|
|
|
|
case "center":
|
|
|
|
|
|
e = (n - r) / 2, i = (s - a) / 2;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "top-left":
|
|
|
|
|
|
e = 0, i = 0;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "top-center":
|
|
|
|
|
|
e = (n - r) / 2, i = 0;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "top-right":
|
|
|
|
|
|
e = n - r, i = 0;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "left-center":
|
|
|
|
|
|
e = 0, i = (s - a) / 2;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "right-center":
|
|
|
|
|
|
e = n - r, i = (s - a) / 2;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "bottom-left":
|
|
|
|
|
|
e = 0, i = s - a;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "bottom-center":
|
|
|
|
|
|
e = (n - r) / 2, i = s - a;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "bottom-right":
|
|
|
|
|
|
e = n - r, i = s - a;
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
e = (n - r) / 2, i = (s - a) / 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
e = Math.max(0, Math.min(e, n - r)), i = Math.max(0, Math.min(i, s - a)), this.element.style.left = `${e}px`, this.element.style.top = `${i}px`;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 初始化拖拽功能
|
|
|
|
|
|
*/
|
|
|
|
|
|
initDrag() {
|
|
|
|
|
|
let t = 0, o = 0, e = 0, i = 0;
|
|
|
|
|
|
const n = (a) => {
|
|
|
|
|
|
a.preventDefault(), t = a.clientX, o = a.clientY, e = this.element.offsetLeft, i = this.element.offsetTop, document.addEventListener("mousemove", s), document.addEventListener("mouseup", r);
|
|
|
|
|
|
}, s = (a) => {
|
|
|
|
|
|
const l = a.clientX - t, p = a.clientY - o;
|
|
|
|
|
|
let d = e + l, h = i + p;
|
|
|
|
|
|
const m = this.container.clientWidth - this.element.offsetWidth, b = this.container.clientHeight - this.element.offsetHeight;
|
|
|
|
|
|
d = Math.max(0, Math.min(d, m)), h = Math.max(0, Math.min(h, b)), this.element.style.left = `${d}px`, this.element.style.top = `${h}px`;
|
|
|
|
|
|
}, r = () => {
|
|
|
|
|
|
document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", r);
|
|
|
|
|
|
};
|
|
|
|
|
|
this.header.addEventListener("mousedown", n);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 初始化缩放功能
|
|
|
|
|
|
*/
|
|
|
|
|
|
initResize() {
|
|
|
|
|
|
const t = this.element.querySelector(".bim-dialog-resize-handle");
|
|
|
|
|
|
if (!t) return;
|
|
|
|
|
|
let o = 0, e = 0, i = 0, n = 0;
|
|
|
|
|
|
const s = (l) => {
|
|
|
|
|
|
l.preventDefault(), l.stopPropagation(), o = l.clientX, e = l.clientY, i = this.element.offsetWidth, n = this.element.offsetHeight, document.addEventListener("mousemove", r), document.addEventListener("mouseup", a);
|
|
|
|
|
|
}, r = (l) => {
|
|
|
|
|
|
const p = l.clientX - o, d = l.clientY - e, h = Math.max(this.options.minWidth || 100, i + p), m = Math.max(this.options.minHeight || 50, n + d);
|
|
|
|
|
|
this.element.style.width = `${h}px`, this.element.style.height = `${m}px`;
|
|
|
|
|
|
}, a = () => {
|
|
|
|
|
|
document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", a);
|
|
|
|
|
|
};
|
|
|
|
|
|
t.addEventListener("mousedown", s);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 动态设置内容
|
|
|
|
|
|
* @param content 内容元素或 HTML 字符串
|
|
|
|
|
|
*/
|
|
|
|
|
|
setContent(t) {
|
|
|
|
|
|
this.contentArea.innerHTML = "", typeof t == "string" ? this.contentArea.innerHTML = t : this.contentArea.appendChild(t);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 关闭弹窗并销毁
|
|
|
|
|
|
*/
|
|
|
|
|
|
close() {
|
|
|
|
|
|
this._isDestroyed || (this.element.remove(), this._isDestroyed = !0, this.options.onClose && this.options.onClose());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
class v {
|
|
|
|
|
|
dialog;
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 构造函数
|
|
|
|
|
|
* @param container 父容器
|
|
|
|
|
|
*/
|
|
|
|
|
|
constructor(t) {
|
|
|
|
|
|
const o = document.createElement("div");
|
|
|
|
|
|
o.className = "bim-info-dialog-content";
|
|
|
|
|
|
const e = document.createElement("h3");
|
|
|
|
|
|
e.textContent = "Model Information";
|
|
|
|
|
|
const i = document.createElement("ul");
|
|
|
|
|
|
i.innerHTML = `
|
|
|
|
|
|
<li><strong>Name:</strong> Sample Project</li>
|
|
|
|
|
|
<li><strong>Version:</strong> 1.0.0</li>
|
|
|
|
|
|
<li><strong>Date:</strong> ${(/* @__PURE__ */ new Date()).toLocaleDateString()}</li>
|
|
|
|
|
|
<li><strong>Status:</strong> <span style="color: green;">Active</span></li>
|
|
|
|
|
|
`;
|
|
|
|
|
|
const n = document.createElement("button");
|
|
|
|
|
|
n.textContent = "Update Status", n.style.marginTop = "10px", n.onclick = () => {
|
|
|
|
|
|
alert("Status updated!");
|
|
|
|
|
|
}, o.appendChild(e), o.appendChild(i), o.appendChild(n), this.dialog = new u({
|
2025-12-03 15:46:18 +08:00
|
|
|
|
container: t,
|
2025-12-03 18:35:05 +08:00
|
|
|
|
title: "Project Info (Wrapped)",
|
|
|
|
|
|
content: o,
|
|
|
|
|
|
width: 320,
|
|
|
|
|
|
height: "auto",
|
|
|
|
|
|
position: "center",
|
|
|
|
|
|
resizable: !0,
|
|
|
|
|
|
draggable: !0
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 关闭弹窗
|
|
|
|
|
|
*/
|
|
|
|
|
|
close() {
|
|
|
|
|
|
this.dialog.close();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
class w {
|
|
|
|
|
|
/** 弹窗挂载的父容器 */
|
|
|
|
|
|
container;
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 构造函数
|
|
|
|
|
|
* @param container 弹窗挂载的目标容器
|
|
|
|
|
|
*/
|
|
|
|
|
|
constructor(t) {
|
|
|
|
|
|
this.container = t;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 创建一个通用弹窗
|
|
|
|
|
|
* @param options 弹窗配置选项(不需要传 container,自动使用管理器绑定的容器)
|
|
|
|
|
|
* @returns BimDialog 实例
|
|
|
|
|
|
*/
|
|
|
|
|
|
create(t) {
|
|
|
|
|
|
return new u({
|
|
|
|
|
|
container: this.container,
|
|
|
|
|
|
...t
|
2025-12-03 15:46:18 +08:00
|
|
|
|
});
|
|
|
|
|
|
}
|
2025-12-03 18:35:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 显示二次封装的模型信息弹窗
|
|
|
|
|
|
* 演示如何调用特定的业务弹窗组件
|
|
|
|
|
|
*/
|
|
|
|
|
|
showInfoDialog() {
|
|
|
|
|
|
new v(this.container);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
class C {
|
|
|
|
|
|
/** 主容器元素 */
|
|
|
|
|
|
container;
|
|
|
|
|
|
/** 内部包装器元素,用于承载所有 UI 组件 */
|
|
|
|
|
|
wrapper = null;
|
|
|
|
|
|
/** 工具栏管理器实例 */
|
|
|
|
|
|
toolbar = null;
|
|
|
|
|
|
/** 弹窗管理器实例 */
|
|
|
|
|
|
dialog = null;
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 构造函数
|
|
|
|
|
|
* @param container 容器元素或容器 ID
|
|
|
|
|
|
*/
|
|
|
|
|
|
constructor(t) {
|
|
|
|
|
|
const o = typeof t == "string" ? document.getElementById(t) : t;
|
|
|
|
|
|
if (!o) throw new Error("Container not found");
|
|
|
|
|
|
this.container = o, this.init();
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 初始化方法
|
|
|
|
|
|
* 创建 DOM 结构并初始化各子模块
|
|
|
|
|
|
*/
|
|
|
|
|
|
init() {
|
|
|
|
|
|
this.container.innerHTML = "", this.wrapper = document.createElement("div"), this.wrapper.className = "bim-engine-wrapper";
|
|
|
|
|
|
const t = document.createElement("h1");
|
|
|
|
|
|
t.textContent = "BimEngine", t.className = "bim-engine-title";
|
|
|
|
|
|
const o = document.createElement("p");
|
|
|
|
|
|
o.textContent = "这是一个使用BIM-ENGINE。", o.className = "bim-engine-desc";
|
|
|
|
|
|
const e = document.createElement("div");
|
|
|
|
|
|
e.id = "opt-btn-groups", e.className = "bim-engine-opt-btn-container", this.wrapper.appendChild(t), this.wrapper.appendChild(o), this.dialog = new w(this.wrapper), this.toolbar = new g(e);
|
|
|
|
|
|
const i = document.createElement("button");
|
|
|
|
|
|
i.textContent = "打开测试弹窗", i.className = "bim-engine-btn", i.onclick = () => {
|
|
|
|
|
|
this.dialog?.create({
|
|
|
|
|
|
title: "测试弹窗",
|
|
|
|
|
|
content: '<div style="padding: 10px;">这是一个 <b>可拖拽</b> 且 <b>可缩放</b> 的弹窗。<br><br>你可以尝试拖动标题栏,或者拖动右下角改变大小。</div>',
|
|
|
|
|
|
width: 300,
|
|
|
|
|
|
height: 400,
|
|
|
|
|
|
position: "top-left",
|
|
|
|
|
|
draggable: !0,
|
|
|
|
|
|
resizable: !0
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
const n = document.createElement("button");
|
|
|
|
|
|
n.textContent = "打开信息弹窗 (封装版)", n.className = "bim-engine-btn", n.style.marginLeft = "10px", n.onclick = () => {
|
|
|
|
|
|
this.dialog?.showInfoDialog();
|
|
|
|
|
|
}, this.wrapper.appendChild(i), this.wrapper.appendChild(n), this.wrapper.appendChild(e), this.container.appendChild(this.wrapper);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 销毁实例
|
|
|
|
|
|
* 清理所有资源和 DOM 元素
|
|
|
|
|
|
*/
|
2025-12-03 15:46:18 +08:00
|
|
|
|
destroy() {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
this.toolbar && (this.toolbar.destroy(), this.toolbar = null), this.dialog = null, this.container.innerHTML = "";
|
2025-12-03 12:00:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
export {
|
2025-12-03 18:35:05 +08:00
|
|
|
|
C as BimEngine,
|
|
|
|
|
|
f as OptBtnGroups
|
2025-12-03 12:00:46 +08:00
|
|
|
|
};
|
|
|
|
|
|
//# sourceMappingURL=bim-engine-sdk.es.js.map
|