Select to view content in your preferred language

How to change the default color of the draw widget?

3760
10
Jump to solution
07-05-2016 07:45 AM
HuyVo1
by
New Contributor II


Hello everyone,

is there somewhere in the code that can change the default color of the draw widget from black to ,say , red?

0 Kudos
1 Solution
10 Replies
HuyVo1
by
New Contributor II

Thank you very much !

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.

0 Kudos
HuyVo1
by
New Contributor II

I accidentally marked my answer as correct answer. I'm looking for a way to resolve it. Is there anyway to fix this problem?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

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.

MichaelAugust
Occasional Contributor III

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!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

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);
MichaelAugust
Occasional Contributor III

Thanks Robert, I'll check that out!

0 Kudos
by Anonymous User
Not applicable

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.

0 Kudos