Select to view content in your preferred language

Forcing "Sketch"(rectangle) to an equal-sided Square

334
2
10-11-2022 01:11 PM
Paco
by
Frequent Contributor

Hello all!    wondering if there is a way to make the Sketch widget create an equal-sided Square, instead of a Rectangle?   the rectangle selection mode works great,  but I need the selection to be a square.

 

Thanks again!

pvs

0 Kudos
2 Replies
JoelBennett
MVP Regular Contributor

I don't think there's a documented way to automate this, but the user can hold the Shift key down while drawing with the rectangle tool, and it will force a square.  This can be confirmed by using the Shift key in combination with the "Draw a rectangle" tool in this sample.

0 Kudos
Paco
by
Frequent Contributor

Thanks.   however my polygon/rectangle Sketch does not seem to be affected by the shift key?   but I will look into it further.   thankyou!

glayer = new GraphicsLayer();

const sketch = new Sketch({
layer: glayer,
view: view,
creationMode: "single",
availableCreateTools: ["point", "polyline", "rectangle"],
layout: "vertical",
label:"select a drawing tool for "
});

0 Kudos