Hello everyone! This question is just out of wonder, I know it’s better to use CallbackProperty.But I tried in the framework of vue that making the entity’s coordinates reactive by computed property does not work. It seems that when the entity has drawn on the globe, then Cesium dosn’t have the functionality to redraw the entity according to the update of computed propery. Am I right?
It is only about the Vuejs. You just pass a value to entity. Like:
const rectangleVar = computed(() => /* assume it is value 1 */)
viewer.entities.add({
xxx: rectangleVar.value
// At that time, the value of rectangleVar is just 1, so it is same to:
// xxx: 1
// Of course it is not reactive.
})
To keep reactive, you can:
const e = viewer.entities.add({/* */})
const rectangleVar = computed(() => /* */)
watchEffect(() => {
e.xxx = rectangleVar.value
})
Or
const rectangleVar = computed(() => /* */)
const e = viewer.entities.add({
xxx: new Cesium.CallbackProperty(() => rectangleVar.value, false)
})
1 Like
