Select to view content in your preferred language

Using SketchViewModel to Move Graphic With PictureMarkerSymbol

80
2
Jump to solution
Tuesday
ThomasDale
New Contributor

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?

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

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

 

View solution in original post

2 Replies
UndralBatsukh
Esri Regular Contributor

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

 

ThomasDale
New Contributor

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"
         });
      }
   });
})

 

 

0 Kudos