I try to modify a sample by creating a button and see here: Edit fiddle - JSFiddle
Not sure how to create a button to call the following code:
Original one:
map.on("load", function() {
var tb = new Draw(map);
tb.on("draw-end", lang.hitch(map, getAreaAndLength));
tb.activate(Draw.FREEHAND_POLYGON);
});
Please help. Thanks.