Hello everyone,
is there somewhere in the code that can change the default color of the draw widget from black to ,say , red?
Solved! Go to Solution.
Huy,
Sure you just set the fillSymbol:
Draw | API Reference | ArcGIS API for JavaScript 3.17 | fillSymbol
or the lineSymbol:
Draw | API Reference | ArcGIS API for JavaScript 3.17 | lineSymbol
or the markerSymbol:
Draw | API Reference | ArcGIS API for JavaScript 3.17 | markerSymbol
Huy,
Sure you just set the fillSymbol:
Draw | API Reference | ArcGIS API for JavaScript 3.17 | fillSymbol
or the lineSymbol:
Draw | API Reference | ArcGIS API for JavaScript 3.17 | lineSymbol
or the markerSymbol:
Draw | API Reference | ArcGIS API for JavaScript 3.17 | markerSymbol
Thank you very much !
Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.
I accidentally marked my answer as correct answer. I'm looking for a way to resolve it. Is there anyway to fix this problem?
Huy,
Sure just open this thread (you can not do this from your inbox) and click on the Correct Answer link on the appropriate reply.
Could either of you describe in more detail which section of the Draw widget code, and which file, that you need to edit the default fill? I'm specifically looking to have our default polygon draw with a 45 deg line hatch and a 2 pt. outline for example, however I'm looking through the Widget.js file and am having a little trouble connecting the dots from the links above as to how/where to alter the widget code, thanks!
Michael,
In the DrawWidget/Widget.js file find the postCreate function (line 6):
postCreate: function() {
this.inherited(arguments);
this._initLayers();
jimuUtils.combineRadioCheckBoxWithLabel(this.showMeasure, this.showMeasureLabel);
this.drawBox.setMap(this.map);
this.drawBox.setPolygonSymbol(yoursymbol);
Thanks Robert, I'll check that out!
I'm just stumbling across this thread, but I also want to change the default polygon color in the Draw widget. I'm not getting how to do this through the line of code inserted on line 6 above. I've experimented and tried inserting all kinds of parameters but I'm obviously not getting it. All I want to do is change the default polygon color to red with a black outline. Can someone help me implement this? Thanks.