zouyaoji / vue-cesium

🎉 Vue 3.x components for CesiumJS.
https://zouyaoji.top/vue-cesium
MIT License
1.47k stars 317 forks source link

[Bug Report] VcPrimitiveGround组件加载的图层无法被VcCollectionPrimitive管理到 #350

Closed ShenWeiQun closed 1 year ago

ShenWeiQun commented 1 year ago

VueCesium version

3.1.3

OS/Browsers version

Google Chrome 110.0.5481.78

Vue version

3.2.47

Cesium version

1.102.0

Reproduction Link

https://codepen.io/shenweiqun/pen/wvEvzrK

Steps to reproduce

vc-collection-primitive :show="false" @click="onClick" 在示例页面上给组件vc-collection-primitive增加属性不会生效 例如 属性 :show="false" 时间 @click="onClick"

What is Expected?

属性设置正常 操作设置正常

What is actually happening?

属性设置异常 操作设置异常

ShenWeiQun commented 1 year ago

When the component VcCollectionPrimitive of a component is VcPrimitiveGround, Unable to manage child components In file packages\composables\use-primitives\index.ts,I found

const primitives = vcInstance.cesiumClass.includes('Ground') ? commonState.$services.groundPrimitives : commonState.$services.primitives

I think it's affecting you here

zouyaoji commented 1 year ago

我测试了,确实改成 const primitives = commonState.$services.primitives

就能管理到,想请教一下你清楚 viewer.scene.groundPrimitives 和 viewe.scene.primitives 有啥区别不。

我之前就简单的把带‘ground’的放到groundPrimitives 中了。

ShenWeiQun commented 1 year ago

搜索了一下没找到直接的解释 根据issues https://github.com/CesiumGS/cesium/pull/6316 https://github.com/CesiumGS/cesium/pull/2960 推测,增加groundPrimitives的目的是为了贴地的primitive排序方便 根据issues https://github.com/CesiumGS/cesium/issues/7639 推测,在未来的计划中该属性可能会被移除

ShenWeiQun commented 1 year ago

不论原始目的如何,如果组件VcPrimitiveGroundVcCollectionPrimitive的子组件,状态应该能被父组件管理到

zouyaoji commented 1 year ago

嗯,下个版本改一下。