The Unit type for the geometry service accepts the code value.
The code value can be found on the esriSRUnitType Constants page.
For example, if you want esriSRUnit_Meter, you can provide the value 9001
Try to just use ESRI's API, just check to see the extent of the map and move it back if its outside of the bounding box.
Try adding this:
var previousExtent = map.extent.getExtent();
let currentExtent = map.extent.getExtent();
// Update previous extent
You have a problem in the order of the dojo require statements.
The following order is the right one, putting the domReady at the end:
The company I work for created a customized solution to this exact issue, I cannot copy the code but I can give you a guideline:
- Create a variable that indicates 'inDrawing' state
- Create a variable for 'currentPoints'
- Create a graphicLayer for measurements
- Create a listener on "mouse-move"/"mouse-drag" event on the map
- If "inDrawing":