esriConfig.portalUrl = this.options.portalUrl;
this.graphicsLayer = new GraphicsLayer();
// create the webmap using the desired portal id
this.webMap = new WebMap({
portalItem: {
id: this.options.portalId
},
layers: [this.graphicsLayer]
});
this.view = new MapView({
container: mapContainerId,
map: this.webMap
});
this.sketch = new Sketch({
layer: this.graphicsLayer,
view: this.view,
visibleElements: {
createTools: {
"circle": this.options.createTools.circle,
"point": this.options.createTools.point,
"polygon": this.options.createTools.polygon,
"polyline": this.options.createTools.polyline,
"rectangle": this.options.createTools.rectangle
},
selectionTools: {
"lasso-selection": false,
"rectangle-selection": false,
},
settingsMenu: this.options.settingsMenu,
undoRedoMenu: this.options.undoRedoMenu
}
});
this.view.ui.add(this.sketch, this.options.controlsPosition);
I have a method on the widget that I can then call that changes the visibility of the createTools based on the name of the tool passed in:
toggleTool: function (tool, value) {
this.sketch.visibleElements.createTools[tool] = value;
//what to call here!?!
}
Then I call it as per:
$("#map").mapcontrol("toggleTool", "circle", true);
The circle value gets toggled to true as expected. If I then click the tool bar or the zoom in / zoom out icons on the map after toggling the value then the circle tool appears.