huweili-cesium 1.2.54 → 1.2.56
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.
- package/js/basis.js +20 -3
- package/js/customToolbarButtons.js +1 -0
- package/package.json +1 -1
package/js/basis.js
CHANGED
|
@@ -763,10 +763,27 @@ export function basicConfig() {
|
|
|
763
763
|
const defaultVisibleTitles = ['展开/折叠 工具栏', '展开', '收缩', '指北针', '2D/3D视角切换', '降低视角', '抬升视角', '更多', '收起更多']
|
|
764
764
|
let isMoreExpanded = false
|
|
765
765
|
|
|
766
|
+
const isTruthyAttr = (value) => value === true || value === 'true' || value === ''
|
|
767
|
+
|
|
766
768
|
const isDefaultVisibleToolbarItem = (item) => {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
769
|
+
if (!item) return false
|
|
770
|
+
|
|
771
|
+
const dataset = item.dataset || {}
|
|
772
|
+
const isMarkedDefaultVisible = isTruthyAttr(dataset.toolbarDefaultVisible)
|
|
773
|
+
|| isTruthyAttr(item.getAttribute?.('data-toolbar-default-visible'))
|
|
774
|
+
|| isTruthyAttr(item.getAttribute?.('isDefaultVisible'))
|
|
775
|
+
|| isTruthyAttr(item.getAttribute?.('is-default-visible'))
|
|
776
|
+
|
|
777
|
+
const isMarkedMoreToggle = isTruthyAttr(dataset.toolbarMoreToggle)
|
|
778
|
+
|| isTruthyAttr(item.getAttribute?.('data-toolbar-more-toggle'))
|
|
779
|
+
|| isTruthyAttr(item.getAttribute?.('isMoreToggle'))
|
|
780
|
+
|| isTruthyAttr(item.getAttribute?.('is-more-toggle'))
|
|
781
|
+
|
|
782
|
+
if (isMarkedDefaultVisible || isMarkedMoreToggle || dataset.toolbarDragReady === 'true') return true
|
|
783
|
+
|
|
784
|
+
const title = item.getAttribute?.('title') || item.title || ''
|
|
785
|
+
const text = item.textContent?.trim() || ''
|
|
786
|
+
return defaultVisibleTitles.includes(title) || text.includes('更多')
|
|
770
787
|
}
|
|
771
788
|
|
|
772
789
|
const lockToolbarCurrentPosition = (toolbar) => {
|
|
@@ -91,6 +91,7 @@ export function createCustomToolbarButtons() {
|
|
|
91
91
|
toolbar.style.width = isRow ? 'fit-content' : 'auto'
|
|
92
92
|
toolbar.style.minWidth = 'unset'
|
|
93
93
|
toolbar.style.flexWrap = 'nowrap'
|
|
94
|
+
toolbar.style.position = 'absolute'
|
|
94
95
|
|
|
95
96
|
return buttons.map(opt => addToolbarButton(viewer, opt)).filter(Boolean)
|
|
96
97
|
}
|