When I use this https://developers.arcgis.com/javascript/latest/sample-code/views-switch-2d-3d/ After the demo, I added many GeoJSONLayer layers to the 3D view, but after modifying the 3D renderer, the 3D view did not update in real time. When I switched from 3D to 2D, the modified renderer view was refreshed after switching back, and the 2D modified renderer can be refreshed in real time
const is3D = this.appConfig.activeView.type === '3d'
const activeViewpoint = this.appConfig.activeView.viewpoint.clone()
this.appConfig.activeView.container = null
if (is3D) {
this.appConfig.mapView.viewpoint = activeViewpoint
this.appConfig.mapView.container = this.appConfig.container
this.appConfig.activeView = this.appConfig.mapView
window._editScene = this.appConfig.mapView
} else {
this.appConfig.sceneView.viewpoint = activeViewpoint
this.appConfig.sceneView.container = this.appConfig.container
this.appConfig.activeView = this.appConfig.sceneView
window._editScene = this.appConfig.sceneView
}
let dataLayer = window._editScene.map.findLayerById(res.id)
dataLayer.renderer.symbol.width = 5
dataLayer.refresh()
It's just a snippet of my Vue code. I will save the view to the window and search for the layer ID on other pages, and then modify the renderer inside. This method can be used to modify 2D views