huweili-cesium 1.2.53 → 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 +15 -0
  2. package/package.json +1 -1
package/js/basis.js CHANGED
@@ -769,9 +769,24 @@ export function basicConfig() {
769
769
  return item?.dataset?.toolbarDragReady === 'true' || defaultVisibleTitles.includes(title) || text.includes('更多')
770
770
  }
771
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'
783
+ }
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.53",
3
+ "version": "1.2.54",
4
4
  "description": "基于 Cesium 的地图工具库(无人机态势、轨迹、围栏、工具栏等)",
5
5
  "type": "module",
6
6
  "main": "./index.js",