Sketch isn't showing my drawn graphic

68
1
01-17-2022 11:39 AM
dowhathappens
New Contributor

Hello all,

I'm working on getting my maps up in React and I'm having some issues with the Sketch module.

After I complete the shape it only shows me the outline of the selected area, but I don't see the grey selected area like the tutorial example here

const model = new Sketch({
                view: view,
                layer: graphicLayerCreate,
                creationMode: "update",    
            });

 
I have tried to add another graphic to the layer with the geometry I receive back. Any ideas?

model.on("create", (evt) => {
    if (evt.state === "complete") { 
        //put another graphic on the layer 
    }
})
0 Kudos
1 Reply
MatthewDriscoll
MVP Regular Contributor

It might be that you are using a different theme or version.  You can set the symbology to whatever you desire.

 

   /// Style the Sketch Symbol
    const fillSymbolsketch = {
      type: "simple-fill",
      color: [255,10,2, 0.5],
      outline: {
        color: [230,0,0],
        width: 1     
      },
      style: "frontward-diagonal"
    };
    
    // Construct sketch graphics layer
    const sketchlayer = new GraphicsLayer({
      symbol: fillSymbolsketch,
      title: "Sketch Layer",
      listMode: "hide"
    });

    // create the sketch widget
    const sketch = new Sketch({
      layer: sketchlayer,
      view: theView,
      position: "top-left", 
      layout: "vertical",
      index: 5,
      // graphic will be selected as soon as it is created
      creationMode: "update"    
    });
0 Kudos