Module 34 - Sketch and Drawing
Level 7 · Editing & Real Time · 🟠 · 4 hours · Prereq: Module 33
What you'll build
A drawing toolbar with a custom UI over SketchViewModel: draw points, lines, polygons,
rectangles and circles; move, reshape and rotate; snap to existing features; multi-select and
transform together; undo/redo; and a shapes list.
This is the Design Tab from this repository, built from first principles.
Why this matters
Letting users create geometry is the boundary between a viewer and a tool. SketchViewModel is
the SDK's answer, and it is powerful, stateful, and full of interactions that only appear when
you build something real with it.
The closure and selection traps in this module cause bugs that are genuinely hard to diagnose.
Concepts
1. Sketch widget vs SketchViewModel
// The widget - a Calcite toolbar, five minutes
import Sketch from "@arcgis/core/widgets/Sketch.js";
const sketch = new Sketch({ view, layer, creationMode: "update" });
view.ui.add(sketch, "top-right");
// The ViewModel - your UI, all the logic
import SketchViewModel from "@arcgis/core/widgets/Sketch/SketchViewModel.js";
const vm = new SketchViewModel({ view, layer });
vm.create("polygon");
Use the ViewModel for anything with a design system, a custom tool palette, or extra behaviour per shape type. The widget is right for an internal tool where the default look is fine.
2. Creating
vm.create("point");
vm.create("multipoint");
vm.create("polyline");
vm.create("polygon");
vm.create("rectangle");
vm.create("circle");
vm.create("polygon", { mode: "click" }); // click each vertex, double-click to finish
vm.create("polygon", { mode: "freehand" }); // drag to draw
vm.create("polygon", { mode: "hybrid" }); // both (default)
vm.cancel(); // abort the in-progress creation
The create event fires repeatedly, which is what people miss:
vm.on("create", (event) => {
switch (event.state) {
case "start": break; // drawing began
case "active": break; // a vertex was added/moved - fires a LOT
case "complete": onShapeFinished(event.graphic); break;
case "cancel": break;
}
});
Only act on "complete" unless you specifically want live feedback (a running area
measurement, for example - Module 25 used "active" for exactly that).
3. Updating
vm.update(graphic, { tool: "transform" }); // move/rotate/scale handles
vm.update(graphic, { tool: "reshape" }); // vertex handles
vm.update(graphic, { tool: "move" }); // move only
vm.update([g1, g2, g3], { tool: "transform" }); // several together
vm.complete(); // finish the update
vm.cancel(); // discard changes
vm.on("update", (event) => {
switch (event.state) {
case "start": break;
case "active":
// event.toolEventInfo.type: "move-start" | "move" | "move-stop" |
// "reshape-start" | "reshape" | "reshape-stop" | "rotate-start" | …
break;
case "complete":
persist(event.graphics);
break;
}
});
vm.update([g1, g2], { tool: "transform" }) moves several graphics together - that's
gotcha #8 in this repository, and it comes with a warning:
"Guard against accidental selection of 'owned' graphics by maintaining a
Setof UIDs and cancellingvm.on("update")immediately if the UID is in that set."
The problem: SketchViewModel will happily start updating a graphic your application put in
the layer for its own purposes - a highlight ring, a label anchor, a measurement guide. The
user drags it and your internal state desynchronises from the map.
4. Symbols
const vm = new SketchViewModel({
view,
layer,
pointSymbol: { type: "simple-marker", color: "#0066ff", size: 10,
outline: { color: "white", width: 1.5 } },
polylineSymbol: { type: "simple-line", color: "#0066ff", width: 2 },
polygonSymbol: { type: "simple-fill", color: [0, 102, 255, 0.15],
outline: { color: "#0066ff", width: 2 } },
// 3D
pointSymbol3D: { type: "point-3d", symbolLayers: [{ type: "icon", size: 10,
resource: { primitive: "circle" }, material: { color: "#0066ff" } }] },
polygonSymbol3D: { type: "polygon-3d", symbolLayers: [{ type: "fill",
material: { color: [0, 102, 255, 0.2] } }] },
});
In a SceneView the *Symbol3D properties are used. Setting only the 2D ones gives you
flat billboards, which is sometimes fine and sometimes not what you drew.
5. Snapping
import allLayerSnapping from "@arcgis/core/views/interactive/snapping/allLayerSnapping.js";
vm.snappingOptions = {
enabled: true,
selfEnabled: true, // snap to the shape being drawn (close a polygon exactly)
featureEnabled: true, // snap to other features
featureSources: [
{ layer: parcels, enabled: true },
{ layer: roads, enabled: true },
],
distance: 12, // screen pixels
};
Or snap to every layer:
vm.snappingOptions = {
enabled: true,
featureSources: await allLayerSnapping({ view }),
};
selfEnabled is what lets a user close a polygon exactly on its first vertex. Without it,
"closed" polygons have a hairline gap that fails validity checks downstream.
The <arcgis-snapping-controls> component gives users a toggle UI for free.
6. Undo and redo
vm.undo();
vm.redo();
vm.canUndo;
vm.canRedo;
Scope: SketchViewModel's undo stack covers the current operation - vertices within a
create, or steps within an update. It does not cover completed shapes.
Application-level undo (remove the last completed shape) is yours to build. Don't promise the user one stack when there are two.
7. Closure safety - the trap that costs hours
// ❌ `activeTool` is captured at registration. Changing it later does nothing here.
let activeTool = "polygon";
vm.on("create", (event) => {
if (event.state !== "complete") return;
applyStyle(event.graphic, activeTool); // always "polygon"
});
The handler is registered once and lives for the component's lifetime. Any variable it reads is the one captured at registration.
In plain JS, a let in an enclosing scope actually works, because there's one binding.
In React, it doesn't - each render creates new bindings, and the handler closed over the
first render's.
// The fix: mirror state into refs
const [activeTool, setActiveTool] = useState("polygon");
const activeToolRef = useRef(activeTool);
useEffect(() => { activeToolRef.current = activeTool; }, [activeTool]);
// Now the handler reads the current value
vm.on("create", (event) => {
if (event.state !== "complete") return;
applyStyle(event.graphic, activeToolRef.current);
});
This repository documents it as a rule: "All state used inside ArcGIS event handler closures must be mirrored to refs and kept in sync via
useEffect. SeeeditHeightRef,activeToolRef,shapesRef,selectedIdRefinDesignToolbar.jsx."
Module 37 covers the React side in full. The pattern below uses a mutable state object, which is the framework-agnostic equivalent.
Build it - the drawing toolbar
Step 1 - The shape model
// src/sketch/shapeStore.js
/**
* Shapes the user has drawn.
*
* The store is the source of truth; the GraphicsLayer is a rendering of it.
* Keeping them separate is what makes undo, save/restore and property edits
* tractable.
*/
export class ShapeStore extends EventTarget {
#shapes = new Map(); // id -> shape
#order = []; // draw order
add(shape) {
const id = shape.id ?? crypto.randomUUID();
const entry = { id, name: shape.name ?? `Shape ${this.#order.length + 1}`, ...shape };
this.#shapes.set(id, entry);
this.#order.push(id);
this.#emit("add", entry);
return entry;
}
update(id, patch) {
const existing = this.#shapes.get(id);
if (!existing) return null;
const next = { ...existing, ...patch };
this.#shapes.set(id, next);
this.#emit("update", next);
return next;
}
remove(id) {
const shape = this.#shapes.get(id);
if (!shape) return;
this.#shapes.delete(id);
this.#order = this.#order.filter((x) => x !== id);
this.#emit("remove", shape);
}
get(id) { return this.#shapes.get(id) ?? null; }
get all() { return this.#order.map((id) => this.#shapes.get(id)); }
get size() { return this.#shapes.size; }
/** Find the shape a graphic belongs to. Graphics carry the id in attributes. */
fromGraphic(graphic) {
const id = graphic?.attributes?.shapeId;
return id ? this.get(id) : null;
}
toJSON() {
return {
version: 1,
shapes: this.all.map((s) => ({
...s,
graphic: undefined, // don't serialise the SDK object
geometry: s.graphic?.geometry?.toJSON() ?? s.geometry,
})),
};
}
#emit(type, shape) {
this.dispatchEvent(new CustomEvent(type, { detail: shape }));
this.dispatchEvent(new CustomEvent("change", { detail: { type, shape } }));
}
}
Excluding the Graphic from toJSON and storing the geometry instead is what makes the
document portable. A serialised SDK object is not a document format.
Step 2 - The sketch controller
// src/sketch/sketchController.js
import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer.js";
import { HandleRegistry } from "../handleRegistry.js";
import { ShapeStore } from "./shapeStore.js";
export async function createSketchController({ view, onStateChange }) {
const registry = new HandleRegistry();
const store = new ShapeStore();
const layer = new GraphicsLayer({
title: "Drawings",
elevationInfo: view.type === "3d" ? { mode: "relative-to-ground" } : undefined,
});
view.map.add(layer);
const { default: SketchViewModel } =
await import("@arcgis/core/widgets/Sketch/SketchViewModel.js");
const vm = new SketchViewModel({
view,
layer,
defaultCreateOptions: { mode: "hybrid" },
defaultUpdateOptions: { tool: "reshape", enableRotation: true, enableScaling: true,
toggleToolOnClick: false },
pointSymbol: { type: "simple-marker", color: "#0066ff", size: 10,
outline: { color: "white", width: 1.5 } },
polylineSymbol: { type: "simple-line", color: "#0066ff", width: 2 },
polygonSymbol: { type: "simple-fill", color: [0, 102, 255, 0.15],
outline: { color: "#0066ff", width: 2 } },
});
// ── Mutable state read by long-lived handlers ──
// A plain object rather than closed-over variables: handlers registered
// once must see current values, not the ones captured at registration.
const state = {
activeTool: null,
selectedIds: new Set(),
defaultStyle: { color: "#0066ff", opacity: 0.15 },
};
// UIDs of graphics this controller owns for its own purposes (guides,
// highlights). SketchViewModel will happily let a user drag one of these
// and desynchronise the store from the map.
const ownedUids = new Set();
// ── Create ──
registry.add(vm.on("create", (event) => {
if (event.state === "start") {
onStateChange?.({ drawing: true });
return;
}
if (event.state === "cancel") {
onStateChange?.({ drawing: false, activeTool: null });
state.activeTool = null;
return;
}
if (event.state !== "complete") return;
const graphic = event.graphic;
const shape = store.add({
type: graphic.geometry.type,
tool: state.activeTool,
graphic,
style: { ...state.defaultStyle },
});
// Tag the graphic so hitTest and update handlers can find its shape
graphic.attributes = { ...graphic.attributes, shapeId: shape.id };
onStateChange?.({ drawing: false, activeTool: null, count: store.size });
state.activeTool = null;
}), "sketch");
// ── Update ──
registry.add(vm.on("update", (event) => {
// Reject an update on a graphic we own internally, immediately.
// Doing it on "start" means the user never sees handles appear.
if (event.graphics.some((g) => ownedUids.has(g.uid))) {
vm.cancel();
return;
}
if (event.state === "start") {
state.selectedIds = new Set(
event.graphics.map((g) => g.attributes?.shapeId).filter(Boolean)
);
onStateChange?.({ selectedIds: [...state.selectedIds] });
return;
}
if (event.state === "complete") {
for (const graphic of event.graphics) {
const id = graphic.attributes?.shapeId;
if (id) store.update(id, { graphic });
}
onStateChange?.({ selectedIds: [...state.selectedIds], count: store.size });
}
}), "sketch");
// ── Delete ──
registry.add(vm.on("delete", (event) => {
for (const graphic of event.graphics) {
const id = graphic.attributes?.shapeId;
if (id) store.remove(id);
}
state.selectedIds.clear();
onStateChange?.({ selectedIds: [], count: store.size });
}), "sketch");
return {
store,
layer,
viewModel: vm,
draw(tool) {
state.activeTool = tool;
vm.create(tool);
onStateChange?.({ activeTool: tool, drawing: true });
},
cancel() {
vm.cancel();
state.activeTool = null;
onStateChange?.({ activeTool: null, drawing: false });
},
select(ids, { tool = "transform" } = {}) {
const graphics = ids
.map((id) => store.get(id)?.graphic)
.filter(Boolean);
if (!graphics.length) return;
// One update call with all graphics moves them together (gotcha #8)
vm.update(graphics, { tool });
},
deselect() { vm.complete(); state.selectedIds.clear(); onStateChange?.({ selectedIds: [] }); },
remove(ids) {
for (const id of ids) {
const shape = store.get(id);
if (shape?.graphic) layer.remove(shape.graphic);
store.remove(id);
}
onStateChange?.({ count: store.size, selectedIds: [] });
},
/** Register a graphic as internally owned so Sketch won't let users drag it. */
own(graphic) { ownedUids.add(graphic.uid); return graphic; },
setDefaultStyle(style) { Object.assign(state.defaultStyle, style); },
destroy() {
vm.destroy();
view.map.remove(layer);
layer.destroy();
registry.destroy();
},
};
}
Three details worth reading twice:
stateas a mutable object rather than closed-over variables. Handlers registered once readstate.activeToolat call time, not at registration time.ownedUidsand the immediatevm.cancel()- cancelling on thestartstate means the user never sees handles on a graphic they shouldn't be able to move.graphic.attributes.shapeIdas the link between the SDK object and your store. The alternative - matching by geometry - fails the moment two shapes coincide.
Step 3 - Snapping
// src/sketch/snapping.js
import allLayerSnapping from "@arcgis/core/views/interactive/snapping/allLayerSnapping.js";
export async function configureSnapping({ view, viewModel, layers = null }) {
const featureSources = layers
? layers.map((layer) => ({ layer, enabled: true }))
: await allLayerSnapping({ view });
viewModel.snappingOptions = {
enabled: true,
// Snap to the shape being drawn - this is what closes a polygon exactly
// on its first vertex rather than leaving a hairline gap.
selfEnabled: true,
featureEnabled: true,
featureSources,
distance: 12,
};
return {
setEnabled(enabled) { viewModel.snappingOptions.enabled = enabled; },
setDistance(pixels) { viewModel.snappingOptions.distance = pixels; },
setSources(layerList) {
viewModel.snappingOptions.featureSources = layerList.map((layer) => ({ layer, enabled: true }));
},
};
}
Step 4 - Application-level undo
// src/sketch/history.js
/**
* Undo/redo for COMPLETED shapes.
*
* SketchViewModel's own undo covers vertices within one operation. This is a
* separate stack for "I drew that shape and want it gone". Users expect one
* Ctrl+Z; making it work means driving both.
*/
export function createHistory({ controller, limit = 50 }) {
const undoStack = [];
const redoStack = [];
let applying = false; // don't record our own changes
controller.store.addEventListener("change", (event) => {
if (applying) return;
const { type, shape } = event.detail;
undoStack.push(
type === "add" ? { undo: () => controller.remove([shape.id]),
redo: () => restore(shape) }
: type === "remove" ? { undo: () => restore(shape),
redo: () => controller.remove([shape.id]) }
: { undo: () => {}, redo: () => {} } // updates: see the exercise
);
if (undoStack.length > limit) undoStack.shift();
redoStack.length = 0;
});
function restore(shape) {
controller.layer.add(shape.graphic);
controller.store.add(shape);
}
function run(action) {
applying = true;
try { action(); } finally { applying = false; }
}
return {
undo() {
const entry = undoStack.pop();
if (!entry) return false;
run(entry.undo);
redoStack.push(entry);
return true;
},
redo() {
const entry = redoStack.pop();
if (!entry) return false;
run(entry.redo);
undoStack.push(entry);
return true;
},
get canUndo() { return undoStack.length > 0; },
get canRedo() { return redoStack.length > 0; },
clear() { undoStack.length = 0; redoStack.length = 0; },
};
}
The applying flag stops the history from recording its own undo operations as new
history entries - the same class of guard as the dashboard feedback loop in Module 26.
Step 5 - Keyboard shortcuts
// src/sketch/keyboard.js
export function bindSketchKeyboard({ controller, history, onStateChange }) {
function onKeyDown(event) {
// Don't hijack keys while the user is typing in a form field
const tag = event.target.tagName;
if (tag === "INPUT" || tag === "TEXTAREA" || event.target.isContentEditable) return;
const meta = event.ctrlKey || event.metaKey;
if (meta && event.key === "z" && !event.shiftKey) {
event.preventDefault();
// SketchViewModel's undo first (vertices), ours second (shapes)
if (controller.viewModel.canUndo) controller.viewModel.undo();
else history.undo();
onStateChange?.({});
return;
}
if (meta && (event.key === "y" || (event.key === "z" && event.shiftKey))) {
event.preventDefault();
if (controller.viewModel.canRedo) controller.viewModel.redo();
else history.redo();
onStateChange?.({});
return;
}
if (event.key === "Escape") { controller.cancel(); controller.deselect(); return; }
if (event.key === "Delete" || event.key === "Backspace") {
const selected = controller.viewModel.updateGraphics?.toArray() ?? [];
if (selected.length) {
event.preventDefault();
controller.remove(selected.map((g) => g.attributes?.shapeId).filter(Boolean));
}
return;
}
// Tool shortcuts
const TOOLS = { p: "point", l: "polyline", g: "polygon", r: "rectangle", c: "circle" };
if (!meta && TOOLS[event.key]) { controller.draw(TOOLS[event.key]); }
}
window.addEventListener("keydown", onKeyDown);
return () => window.removeEventListener("keydown", onKeyDown);
}
The input-field guard is not optional. Without it, typing "polygon" in a name field draws five shapes.
Delegating undo to SketchViewModel first is what makes one Ctrl+Z do what the user
expects: undo the last vertex if mid-draw, otherwise undo the last shape.
Step 6 - The shapes list
// src/sketch/shapesList.js
export function renderShapesList({ container, controller, selectedIds = [] }) {
const shapes = controller.store.all;
container.innerHTML = `
<div class="shapes">
<button type="button" class="shapes-toggle" aria-expanded="false">
<span class="chevron">▸</span> SHAPES (${shapes.length})
</button>
<ul class="shapes-list" hidden>
${shapes.map((shape) => `
<li data-id="${shape.id}" class="${selectedIds.includes(shape.id) ? "is-selected" : ""}">
<span class="shape-icon">${iconFor(shape.type)}</span>
<input class="shape-name" value="${escapeAttr(shape.name)}"
aria-label="Shape name" />
<button type="button" data-action="zoom" title="Zoom to">⤢</button>
<button type="button" data-action="delete" title="Delete">✕</button>
</li>`).join("")}
</ul>
</div>
`;
const toggle = container.querySelector(".shapes-toggle");
const list = container.querySelector(".shapes-list");
// Collapsed by default: a list of 40 shapes above the tools pushes them
// off screen, and the tools are what the user came for.
toggle.addEventListener("click", () => {
const expanded = toggle.getAttribute("aria-expanded") === "true";
toggle.setAttribute("aria-expanded", String(!expanded));
toggle.querySelector(".chevron").textContent = expanded ? "▸" : "▾";
list.hidden = expanded;
});
list.addEventListener("click", (event) => {
const li = event.target.closest("[data-id]");
if (!li) return;
const id = li.dataset.id;
const action = event.target.dataset.action;
if (action === "delete") { controller.remove([id]); return; }
if (action === "zoom") {
const shape = controller.store.get(id);
if (shape?.graphic) controller.viewModel.view.goTo(shape.graphic.geometry).catch(() => {});
return;
}
if (!action) controller.select([id]);
});
list.addEventListener("change", (event) => {
if (!event.target.classList.contains("shape-name")) return;
const id = event.target.closest("[data-id]").dataset.id;
controller.store.update(id, { name: event.target.value });
});
}
const iconFor = (type) => ({
point: "●", multipoint: "⋯", polyline: "╱", polygon: "▰", extent: "▭", mesh: "◈",
}[type] ?? "◇");
const escapeAttr = (s) =>
String(s).replace(/[<>&"]/g, (c) => ({ "<": "<", ">": ">", "&": "&", '"': """ }[c]));
How it works
Why create fires on every vertex
The "active" state exists so you can give live feedback - a running length, a vertex count, a
snapping indicator. It fires on every pointer move during creation, which is a lot.
Anything expensive belongs behind "complete". A geodetic area calculation on "active" is
fine (microseconds); a service query is not.
Why SketchViewModel needs its own layer
The graphics being edited must be in a layer the ViewModel controls, because it adds and removes temporary vertex handles, guide lines and the in-progress geometry to that layer.
Pointing it at a layer holding your operational data means the user can drag your data around
and your temporary handles end up in your dataset. Give it a dedicated GraphicsLayer.
Why the ownedUids guard is on update and not select
SketchViewModel doesn't have a selection event you can veto. The update event's "start"
state is the first point at which you know which graphics it's about to edit, and calling
vm.cancel() there aborts before handles are drawn.
There's no earlier hook. That's why the guard looks like it does.
Why snapping is in screen pixels
Snap tolerance in map units would mean a snap that works at street zoom and is unusable at city zoom, or vice versa. Screen pixels are scale-invariant from the user's point of view - 12 px is 12 px whether you're looking at a parcel or a province.
Why the two undo stacks can't be merged
SketchViewModel's undo operates on the in-progress operation's internal state, which the SDK
owns and doesn't expose as commands. Your undo operates on your document model.
You can't push SDK operations onto your stack, and you can't push document operations onto the SDK's. Driving both from one keyboard handler, SDK first, is the workable compromise.
Common mistakes
Acting on event.state === "active".
Fires per pointer move. Use "complete".
Pointing SketchViewModel at an operational data layer.
Users drag your data; temporary handles pollute it.
Closed-over state in long-lived handlers. The handler sees the value from registration time. Mirror to refs (React) or a mutable state object.
No ownedUids guard.
Users drag internal graphics and your store desynchronises.
Matching graphics to shapes by geometry.
Fails when two shapes coincide. Tag with an id in attributes.
Not guarding keyboard shortcuts against input fields. Typing a name draws shapes.
Promising one undo stack when there are two. Ctrl+Z does something different depending on state, with no explanation.
Only setting 2D symbols in a SceneView.
Flat billboards where you expected 3D geometry.
Forgetting selfEnabled in snapping options.
Polygons that look closed and aren't.
Exercises
Exercise 34.1 - The full toolbar
Build it:
- Six drawing tools with keyboard shortcuts
- Select, move, reshape, rotate - including multi-select transform
- Snapping with a toggle and a distance control
- Undo/redo driving both stacks
- A collapsible shapes list with rename, zoom and delete
- A style panel: colour and opacity per shape
- Save/restore the whole drawing as JSON
Exercise 34.2 - Reproduce the closure bug
Deliberately build the broken version: a tool selector whose value is read from a closed-over
variable inside the create handler.
- Verify the bug (the style is always the first tool's)
- Fix it with a mutable state object
- Write the two-sentence code-review comment you'd leave
Exercise 34.3 - The owned-graphic guard
Add a "measurement guide" graphic to the sketch layer that the app draws itself.
- Verify the user can drag it and break your state
- Add the
ownedUidsguard - Verify handles never appear on it
- Note where else in your app this pattern applies
Exercise 34.4 - Geometry validation
On every completed shape:
- Run
simplifyOperator(Module 25) and report whether it changed - Reject self-intersecting polygons with an explanation, or auto-fix them
- Warn on shapes with more than 500 vertices
- Report geodetic area/length in the shapes list
Checkpoint
- When should you act on the
createevent, and why not on"active"? - Why must
SketchViewModelhave its ownGraphicsLayer? - What does the
ownedUidsguard prevent, and why is it on theupdateevent? - Why does a long-lived event handler read stale state, and what's the fix?
- What does
selfEnabledsnapping give you? - What is
SketchViewModel.undo()'s scope, and what isn't covered? - How do you link a
Graphicback to your application's shape record?
- On
"complete"."active"fires on every pointer move during creation - fine for cheap live feedback, wrong for anything expensive or state-changing. - The ViewModel adds and removes temporary vertex handles, guides and in-progress geometry to that layer. Sharing it with operational data means users can drag your data and temporary graphics end up in your dataset.
- It stops users editing graphics the application owns for its own purposes (guides,
highlights), which would desynchronise your store from the map. It goes on
update's"start"state because that's the earliest hook that names the graphics, andvm.cancel()there aborts before handles are drawn. - The handler is registered once and closes over the bindings that existed then. In React each render creates new bindings. Mirror the state into a ref (or a mutable object) that the handler reads at call time.
- Snapping to the shape currently being drawn - which is what closes a polygon exactly on its first vertex instead of leaving a sub-pixel gap.
- It covers the current operation only - vertices within a create, steps within an update. Completed shapes need an application-level stack.
- Tag the graphic:
graphic.attributes.shapeId = shape.id. Matching by geometry fails when two shapes coincide.
Further reading
- https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html
- https://developers.arcgis.com/javascript/latest/sample-code/sketch-geometries/
- https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html
- This repository's
src/components/viewer/DesignTab/DesignToolbar.jsx