Use dark colors for code blocks Copy
1
import "@arcgis/map-components/components/arcgis-sketch";
No specific import is needed for this component.
The Sketch component provides a simple UI for creating and updating graphics on a MapView or a SceneView.
Demo Properties activeToolactiveTool: "circle" | "custom-selection" | "freehandPolygon" | "freehandPolyline" | "lasso-selection" | "mesh" | "move" | "multipoint" | "point" | "polygon" | "polyline" | "rectangle" | "rectangle-selection" | "reshape" | "transform"
When creating new graphics (for example after create() has been called), this property reflects the create tool being used.
Property
autoDestroyDisabled: boolean
If true, the component will not be destroyed automatically when it is disconnected from the document. This is useful when you want to move the component to a different place on the page, or temporarily hide it. If this is set, make sure to call the destroy method when you are done to prevent memory leaks.
Property
availableCreateTools: Array<"rectangle" | "polygon" | "point" | "circle" | "multipoint" | "polyline" | "mesh" | "freehandPolyline" | "freehandPolygon">
Property controlling the visibility and order of create tool buttons.
readonlyProperty
The graphic that is being created.
Property
creationMode: "continuous" | "single" | "update"
Defines the default behavior once the create operation is completed.
Property
defaultCreateOptions: SketchDefaultCreateOptions
Default create options set for the Sketch widget.
Property
defaultGraphicsLayerDisabled: boolean
By default, sketch will auto-create a new graphics layer if none was provided. Set this prop to true to disable this behavior.
Property
defaultUpdateOptions: SketchDefaultUpdateOptions
Default update options set for the Sketch widget.
Property
hideCreateToolsCircle: boolean
Property
hideCreateToolsPoint: boolean
Property
hideCreateToolsPolygon: boolean
Property
hideCreateToolsPolyline: boolean
Property
hideCreateToolsRectangle: boolean
Property
hideDeleteButton: boolean
Property
hideDuplicateButton: boolean
Property
hideLabelsToggle: boolean
Property
hideSelectionCountLabel: boolean
Property
hideSelectionToolsLassoSelection: boolean
Property
hideSelectionToolsRectangleSelection: boolean
Property
hideSettingsMenu: boolean
Property
hideSnappingControls: boolean
Property
hideSnappingControlsElementsEnabledToggle: boolean
Property
hideSnappingControlsElementsFeatureEnabledToggle: boolean
Property
hideSnappingControlsElementsLayerList: boolean
Property
hideSnappingControlsElementsSelfEnabledToggle: boolean
Property
hideTooltipsToggle: boolean
Property
hideUndoRedoMenu: boolean
Property
icon: string
Icon which represents the component. Typically used when the component is controlled by another component (e.g. by the Expand component).
Property
label: string
The Sketch widget's default label.
Property
Options to configure the sketch labels shown next to each segment of the geometry being created or updated.
Property
The GraphicsLayer associated with the Sketch widget.
Property
layout: "horizontal" | "vertical"
Determines the layout/orientation of the Sketch widget.
Property
A SimpleMarkerSymbol, PointSymbol3D, TextSymbol, CIMSymbol, or WebStyleSymbol used for representing the point geometry that is being drawn.
Property
A SimpleFillSymbol, PolygonSymbol3D, or CIMSymbol used for representing the polygon geometry that is being drawn.
Property
A SimpleLineSymbol, LineSymbol3D, or CIMSymbol used for representing the polyline geometry that is being drawn.
Property
position: "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"
Property
By assigning the id
attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene.
Property
scale: "l" | "m" | "s"
Determines the size of widget elements.
Property
showSnappingControlsElementsHeader: boolean
Property
The SnappingOptions for sketching.
state: "active" | "disabled" | "ready"
The current state of the component.
Property
toolbarKind: "docked" | "floating"
Controls the appearance of the sketch widget, allowing the toolbar to adapt its appearance appropriately based on context.
Property
Options to configure the tooltip shown next to the cursor when creating or updating graphics.
readonlyProperty
An array of graphics that are being updated by the Sketch widget.
No slots to display.
Events arcgisCreateEvent
arcgisCreate: SketchCreateEvent
bubbles
Events triggered on this element will be propagated to their outermost elements.
composedThe event is composable and will propagate across the shadow DOM into the standard DOM.
cancelableThe event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisDeleteEvent
arcgisDelete: SketchDeleteEvent
bubbles
Events triggered on this element will be propagated to their outermost elements.
composedThe event is composable and will propagate across the shadow DOM into the standard DOM.
cancelableThe event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisPropertyChangeEvent
arcgisPropertyChange: CustomEvent<{ name: "state"; }>
Emitted when the value of a property is changed. Use this to listen to changes to properties.
bubblesEvents triggered on this element will be propagated to their outermost elements.
composedThe event is composable and will propagate across the shadow DOM into the standard DOM.
cancelableThe event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisReadyEvent
arcgisReady: CustomEvent<void>
Emitted when the component associated with a map or scene view is is ready to be interacted with.
bubblesEvents triggered on this element will be propagated to their outermost elements.
composedThe event is composable and will propagate across the shadow DOM into the standard DOM.
cancelableThe event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisRedoEvent
arcgisRedo: SketchRedoEvent
bubbles
Events triggered on this element will be propagated to their outermost elements.
composedThe event is composable and will propagate across the shadow DOM into the standard DOM.
cancelableThe event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisUndoEvent
arcgisUndo: SketchUndoEvent
bubbles
Events triggered on this element will be propagated to their outermost elements.
composedThe event is composable and will propagate across the shadow DOM into the standard DOM.
cancelableThe event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisUpdateEvent
arcgisUpdate: SketchUpdateEvent
bubbles
Events triggered on this element will be propagated to their outermost elements.
composedThe event is composable and will propagate across the shadow DOM into the standard DOM.
cancelableThe event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
Methods Method Signaturecancel
cancel(): Promise<void>
complete
complete(): Promise<void>
componentOnReady
componentOnReady(): Promise<void>
create
create(tool: "circle" | "point" | "polygon" | "polyline" | "rectangle", createOptions?: __esri.SketchViewModelCreateCreateOptions): Promise<void>
delete
delete(): Promise<void>
destroy
destroy(): Promise<void>
duplicate
duplicate(): Promise<void>
redo
redo(): Promise<void>
triggerUpdate
triggerUpdate(graphic: __esri.Graphic | __esri.Graphic[], updateOptions?: __esri.SketchViewModelUpdateUpdateOptions): Promise<void>
undo
undo(): Promise<void>
Method
cancel(): Promise<void>
Method
complete(): Promise<void>
Method
componentOnReady(): Promise<void>
Create a promise that resolves once component is fully loaded.
ExampleUse dark colors for code blocks Copy
1
2
3
4
const arcgisSketch = document.querySelector("arcgis-sketch");
document.body.append(arcgisSketch);
await arcgisSketch.componentOnReady();
console.log("arcgis-sketch is ready to go!");
Method
create(tool: "circle" | "point" | "polygon" | "polyline" | "rectangle", createOptions?: __esri.SketchViewModelCreateCreateOptions): Promise<void>
tool
"circle" | "point" | "polygon" | "polyline" | "rectangle"
createOptions
SketchViewModelCreateCreateOptions | undefined
Method
delete(): Promise<void>
Method
destroy(): Promise<void>
Permanently destroy the component.
Method
duplicate(): Promise<void>
Method
redo(): Promise<void>
Method
triggerUpdate(graphic: __esri.Graphic | __esri.Graphic[], updateOptions?: __esri.SketchViewModelUpdateUpdateOptions): Promise<void>
graphic
Array<[Graphic](https://next.gha.afd.arcgis.com/javascript/latest/api-reference/esri-Graphic.html)> | Graphic
updateOptions
SketchViewModelUpdateUpdateOptions | undefined
Method
undo(): Promise<void>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4