Select to view content in your preferred language

How to change the Callout of a FeatureLayer that is already on the SceneView

404
2
03-21-2024 02:34 AM
Yamakaze
New Contributor

I already have a FeatureLayer with Callout on SceneView, and I want to change the style of Callout, but it doesn't seem to be updated on SceneView.

This is my updated Callout style code: ↓

 

 

// get featureLayer.labelingInfo's cloned class
const labelingInfoCache = peaks.labelingInfo[0].clone()
// get featureLayer.labelingInfo.symbol cloned class
const symbol = labelingInfoCache.symbol.clone()

// disconnect from featurelayer
peaks.labelingInfo = null

// update properties
symbol.symbolLayers.at(0).material = {
  color: [Math.random() * 255, Math.random() * 255, Math.random() * 255],
}

symbol.callout = {
  type: "line",
  color: [Math.random() * 255, Math.random() * 255, Math.random() * 255],
  border: {
    color: [Math.random() * 255, Math.random() * 255, Math.random() * 255]
  }
}

// Link to featurelayer to enable updates in sceneView
setTimeout(() => {
  labelingInfoCache.symbol = symbol
  peaks.labelingInfo = [labelingInfoCache]
})

 

 

 Every time I run these codes, I can see an update in the color of the Label text (by material.color), but the Callout for the Label is not updated.

 

How can I see updates on SceneView?

0 Kudos
2 Replies
Yamakaze
New Contributor

If I set the featureLayer.elevationInfo.mode to 'on-the-ground', when I run the above code, I can see that the Callout on SceneView has been updated.

But I need to update Callout even if featureLayer.elevationInfo.mode is 'on-the-ground'

 

 

0 Kudos
AndreasUlmer
Esri Contributor

Thanks for reporting, this seems to be a bug. Sent to dev team for further investigation.

I did a few tests but at the moment I can't provide a good workaround.
Use "on-the-ground" of course if that's an option.
Or clone/recreate the whole layer (with new callout config in constructor), but clearly not great either depending on your use case.

Will keep you posted if more intel comes up.