@yangyongtao/gaea 1.1.23 → 1.1.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yangyongtao/gaea",
3
- "version": "1.1.23",
3
+ "version": "1.1.24",
4
4
  "description": "Gaea 3D visualization component library - Vue 3 components based on Godot WASM engine. Includes WMTS layer loading, camera view control, Vite plugin auto-injection, etc.",
5
5
  "type": "module",
6
6
  "main": "src/index.cjs",
@@ -164,6 +164,8 @@ const defaultConfig = {
164
164
  dataHubApiUrl: '',
165
165
  /** 是否显示图层树按钮(右上角重置按钮旁边) */
166
166
  showLayerTreeBtn: false,
167
+ /** 默认隐藏的分类 key 列表,如 ['rainStations', 'rescue'] */
168
+ defaultHiddenCategories: [],
167
169
  /** 图层树分类数据(默认数据,接口数据会合并进来) */
168
170
  layerCategories: [
169
171
  { key: 'seawall', text: '海塘', visible: true, children: [
@@ -401,6 +403,14 @@ export class GaeaApp {
401
403
  // 8. 初始化屏幕图标
402
404
  this._initScreenIcons();
403
405
 
406
+ // 应用默认隐藏的分类
407
+ const hiddenCats = this.config.defaultHiddenCategories || []
408
+ hiddenCats.forEach(key => {
409
+ const cat = this.layerCategories.find(c => c.key === key)
410
+ if (cat) cat.visible = false
411
+ this.setCategoryVisible(key, false)
412
+ })
413
+
404
414
  console.log('[GaeaApp] 后台资源加载完成');
405
415
  } catch (e) {
406
416
  console.error('[GaeaApp] 后台资源加载出错:', e);
@@ -1483,7 +1493,14 @@ export class GaeaApp {
1483
1493
  position: { x: lat, y: lng, z },
1484
1494
  method,
1485
1495
  offset,
1486
- onClick,
1496
+ onClick: (clickedName, data) => {
1497
+ // 派发全局自定义事件,父组件可通过 document.addEventListener 监听
1498
+ document.dispatchEvent(new CustomEvent('gaea-marker-click', {
1499
+ detail: { name: clickedName, text: data.text, position: data.position, category },
1500
+ bubbles: true
1501
+ }))
1502
+ if (onClick) onClick(clickedName, data)
1503
+ },
1487
1504
  category,
1488
1505
  type: 'marker'
1489
1506
  })
@@ -2038,8 +2055,14 @@ export class GaeaApp {
2038
2055
  * @param {Object} opts.Position - { x: 纬度, y: 经度, z: 高程 }
2039
2056
  * @param {Array<number>} opts.rotate - [tilt, heading, bank] 旋转角度
2040
2057
  * @param {Array<number>} opts.scale - [sx, sy, sz] 缩放
2058
+ * @param {Array<number>} [opts.colorDeep=[0,157,187]] - 深水区颜色 [r, g, b](0-255)
2059
+ * @param {number} [opts.flowSpeed=0.1] - 流速
2041
2060
  */
2042
- addWaterHandle = async ({ gltfUrl, Position, rotate, scale }) => {
2061
+ addWaterHandle = async ({
2062
+ gltfUrl, Position, rotate, scale,
2063
+ colorDeep = [0, 157, 187],
2064
+ flowSpeed = 0.1
2065
+ }) => {
2043
2066
  const waterMtl = Gaea.GaeaResourceLoader.Instance.LoadLoaclResource('res://assets/material/river.tres')
2044
2067
  const material = Gaea.ShaderMaterial.ConvertBy(waterMtl)
2045
2068
 
@@ -2060,9 +2083,9 @@ export class GaeaApp {
2060
2083
  element.TiltHeadingBank = new Gaea.Vector3(rotate[0], rotate[1], rotate[2])
2061
2084
 
2062
2085
  Gaea.World.Instance.SetMtlVector3(material, 'uv_scale', new Gaea.Vector3(-7, -7, 1))
2063
- Gaea.World.Instance.SetMtlFloat(material, 'flow_speed', 0.1)
2086
+ Gaea.World.Instance.SetMtlFloat(material, 'flow_speed', flowSpeed)
2064
2087
  Gaea.World.Instance.SetMtlColor(material, 'color_shallow', new Gaea.Color(0 / 255, 157 / 255, 187 / 255, 1))
2065
- Gaea.World.Instance.SetMtlColor(material, 'color_deep', new Gaea.Color(0 / 255, 157 / 255, 187 / 255, 1))
2088
+ Gaea.World.Instance.SetMtlColor(material, 'color_deep', new Gaea.Color(colorDeep[0] / 255, colorDeep[1] / 255, colorDeep[2] / 255, 1))
2066
2089
  Gaea.World.Instance.SetMtlFloat(material, 'transparency_clarity', 3)
2067
2090
  Gaea.World.Instance.SetMtlFloat(material, 'foam_amount', 0.9)
2068
2091
  })
@@ -44,6 +44,8 @@ import vDrag from '../directives/vDrag.js';
44
44
 
45
45
  const props = defineProps({
46
46
  appInstance: { type: Object, required: true },
47
+ /** 需要隐藏的分类 key 列表 */
48
+ hiddenCategories: { type: Array, default: () => [] }
47
49
  });
48
50
 
49
51
  const emit = defineEmits(['close', 'node-click']);
@@ -78,7 +80,10 @@ function onCategoryToggle(categoryKey, checked) {
78
80
 
79
81
  const filteredData = computed(() => {
80
82
  const kw = searchKey.value.trim().toLowerCase();
81
- return categories.value.map(rootNode => {
83
+ const hidden = new Set(props.hiddenCategories);
84
+ return categories.value
85
+ .filter(rootNode => rootNode.visible !== false && !hidden.has(rootNode.key))
86
+ .map(rootNode => {
82
87
  if (!kw) {
83
88
  rootNode.filteredChildren = rootNode.children || [];
84
89
  return rootNode;