huweili-cesium 1.2.52 → 1.2.54

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.
Files changed (2) hide show
  1. package/js/basis.js +17 -2
  2. package/package.json +1 -1
package/js/basis.js CHANGED
@@ -760,18 +760,33 @@ export function basicConfig() {
760
760
  zoomOutDefault(mapId, factor)
761
761
  }
762
762
 
763
- const defaultVisibleTitles = ['展开/折叠 工具栏', '指北针', '2D/3D视角切换', '降低视角', '抬升视角', '更多', '收起更多']
763
+ const defaultVisibleTitles = ['展开/折叠 工具栏', '展开', '收缩', '指北针', '2D/3D视角切换', '降低视角', '抬升视角', '更多', '收起更多']
764
764
  let isMoreExpanded = false
765
765
 
766
766
  const isDefaultVisibleToolbarItem = (item) => {
767
767
  const title = item?.getAttribute?.('title') || item?.title || ''
768
768
  const text = item?.textContent?.trim() || ''
769
- return defaultVisibleTitles.includes(title) || text.includes('更多')
769
+ return item?.dataset?.toolbarDragReady === 'true' || defaultVisibleTitles.includes(title) || text.includes('更多')
770
+ }
771
+
772
+ const lockToolbarCurrentPosition = (toolbar) => {
773
+ if (!toolbar || typeof window === 'undefined') return
774
+
775
+ const rect = toolbar.getBoundingClientRect()
776
+ toolbar.style.position = 'fixed'
777
+ toolbar.style.left = `${Math.max(rect.left, 0)}px`
778
+ toolbar.style.top = `${Math.max(rect.top, 0)}px`
779
+ toolbar.style.right = 'auto'
780
+ toolbar.style.bottom = 'auto'
781
+ toolbar.style.zIndex = toolbar.style.zIndex || '9999'
782
+ toolbar.style.margin = '0'
770
783
  }
771
784
 
772
785
  const applyMoreVisible = (toolbar, expanded) => {
773
786
  if (!toolbar) return
774
787
 
788
+ lockToolbarCurrentPosition(toolbar)
789
+
775
790
  Array.from(toolbar.children).forEach((item) => {
776
791
  const isDefaultVisible = isDefaultVisibleToolbarItem(item)
777
792
  item.style.display = expanded || isDefaultVisible ? '' : 'none'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huweili-cesium",
3
- "version": "1.2.52",
3
+ "version": "1.2.54",
4
4
  "description": "基于 Cesium 的地图工具库(无人机态势、轨迹、围栏、工具栏等)",
5
5
  "type": "module",
6
6
  "main": "./index.js",