huweili-cesium 1.2.40 → 1.2.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,6 +79,19 @@ export function createCustomToolbarButtons() {
79
79
  * @returns {HTMLButtonElement[]} 创建的按钮元素数组
80
80
  */
81
81
  const addToolbarButtons = (viewer, buttons) => {
82
+ const toolbar = viewer.container.querySelector('.cesium-viewer-toolbar')
83
+ if (!toolbar) return []
84
+
85
+ const direction = buttons?.direction || buttons?.[0]?.direction || 'row'
86
+ const isRow = direction !== 'column'
87
+ toolbar.style.display = 'flex'
88
+ toolbar.style.flexDirection = isRow ? 'row' : 'column'
89
+ toolbar.style.alignItems = 'flex-start'
90
+ toolbar.style.gap = '4px'
91
+ toolbar.style.width = isRow ? 'fit-content' : 'auto'
92
+ toolbar.style.minWidth = 'unset'
93
+ toolbar.style.flexWrap = 'nowrap'
94
+
82
95
  return buttons.map(opt => addToolbarButton(viewer, opt)).filter(Boolean)
83
96
  }
84
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huweili-cesium",
3
- "version": "1.2.40",
3
+ "version": "1.2.42",
4
4
  "description": "基于 Cesium 的地图工具库(无人机态势、轨迹、围栏、工具栏等)",
5
5
  "type": "module",
6
6
  "main": "./index.js",