I'm using the SketchViewModel to move a graphic with a PictureMarkerSymbol. The PMS points to an SVG url and it displays as it should. I can get the graphic to move and update just fine, however when I move the graphic, it shows a black box in-between updates. Is there any way to get around this or is this a bug?
Solved! Go to Solution.
Hi there,
I am not able to reproduce the issue you are describing. Here is a simple codepen showing a graphic with base64 svg symbol moving around without any issues. https://codepen.io/U_B_U/pen/qBzoZqe?editors=1000
Hi there,
I am not able to reproduce the issue you are describing. Here is a simple codepen showing a graphic with base64 svg symbol moving around without any issues. https://codepen.io/U_B_U/pen/qBzoZqe?editors=1000
Thank you for your response! This was a huge help. I was able to resolve my problem by reconfiguring my flow to mirror what you wrote with a few differences to match my use case. I think the problem was that I was creating the layer and graphics and adding it to the map inside of an observable that I placed inside the MapView.when() method. I suppose this created a disconnect between the map and the layer? A rough example of my original code (that was not working) is shown below.
mapView.when(() => {
myObservable.subscribe(data => {
if (data) {
const graphic = new Graphic(graphicProps);
const layer = new GraphicsLayer(layerProps);
layer.add(graphic);
mapView.map.add(layer);
const sketch = new Sketch({
layer: layer,
view: mapView,
// graphic will be selected as soon as it is created
creationMode: "update"
});
}
});
})