sketchViewModel.on("create", (event: any) => {
if (event.state === "complete") {
if (document.querySelector("button.active")?.id === "textButton") {
if (fontStyle === "normal") {
textSymbol.color = fontColor;
textSymbol.font.size = fontSize;
textSymbol.haloColor = "";
textSymbol.haloSize = "0px";
} else {
textSymbol.color = fontColor;
textSymbol.font.size = fontSize;
textSymbol.haloColor = fontColor;
textSymbol.haloSize = "0.5px";
}
graphicSymbol = textSymbol;
graphicSymbol.text = prompt(
"Please enter some text",
"Default Text"
);
} else {
graphicSymbol = sketchViewModel.polygonSymbol;
}
graphic = new Graphic({
geometry: event.graphic.geometry,
symbol: graphicSymbol,
});
graphicsToolLayer.add(graphic);
}
});