Select to view content in your preferred language

In arcgis-sketch component How to set all availableCreateTools (freehandpolyline, freehandpolygon, text)

58
1
11 hours ago
RavindraSingh
Frequent Contributor

How can I configure all availableCreateTools, such as freehand polyline, freehand polygon, and text?

Currently, I'm able to access all other tools except the three mentioned above.

I followed Sketch | ArcGIS Maps SDK for JavaScript

Below are the details:

ArcGIS Javascript SDK 4.32.13

React 19.0.0

NOTE: I am not using Typescript. instead, I am writing code in .jsx file.

Case-1: Below is the code snippet being used to initialize the sketch component:

const sketchElement = sketchRef.current;
            sketchElement.view = mapView;
            sketchElement.availableCreateTools = [
                "point",
                "multipoint",
                "freehandPolyline",   // Not showing
                "polyline",
                "freehandPolygon", // Not showing
                "polygon",
                "rectangle",
                "circle",
                "text" // Not showing
            ];
            sketchElement.layer = sketchLayer;

 

I’ve also attempted the second approach as outlined below. Case 2: This is the code snippet used to initialize the sketch component.

<arcgis-sketch
  ref={sketchRef}
  layout="vertical"
  creation-mode="update"
  scale="m"
  toolbar-kind="docked"
  show-create-tools-freehand-polyline
  show-create-tools-freehand-polygon
  
/>

 

Despite trying both approaches, the freehand polyline, freehand polygon, and text buttons are still not appearing in the Sketch UI. Any insights?

0 Kudos
1 Reply
ReneRubalcava
Esri Frequent Contributor

If you're using JSX, you probably need to use the the camelCase for attributes.

  • showCreateToolsFreehandPolygon
  • showCreateToolsFreehandPolyline

However, it does look like the multipoint and text options will not show at the moment. We're looking into this and will have this updated in 5.0.

Ok, small update. I had to set a timeout and the multipoint tool does show up. The text tool does not as that is not quite ready yet. https://codepen.io/odoe/pen/myPJvgd?editors=1001

 

0 Kudos