AnsweredAssumed Answered

Custom canvas drawing in MapView v4.10

Question asked by ncameron on Dec 19, 2018
Latest reply on Dec 19, 2018 by YCabon-esristaff

I'm currently using one custom layer and am building another that draws on a canvas manually in a map view.

The existing one is here: https://github.com/nickcam/AnimatedEnvironmentLayer

 

In v4.9 at a high level the following steps would allow this to happen.

- Subclass a layer

- Create a new canvas element and append it to the container element of the layer.

- If a feature layer swap the context of the layer with one created from the new canvas. 

 

In 4.10 with the drawing occurring all in one webgl context (which is great by the way!), I can't inject a new canvas to essentially replace the svg or the existing canvas for an individual layer.

I've tried using the BaseLayerView2D and can get part of the way, but each render() call seems to clear the context and I'm looking to maintain drawing across frames as in the layer linked above. I don't have a simple example of this at the moment but can put one together if it would help.

 

Are there any examples or patterns that could help with this? Perhaps a custom draw BaseLayerView in a future release?

Outcomes