Bug: 4.26 SimpleLineSymbol is drawn despite setting style to none

1918
3
Jump to solution
04-13-2023 01:23 AM
mattheol
New Contributor II

I have a polygon graphic with SimpleFillSymbol, which has SimpleLineSymbol as outline with style set to 'none'. 

According to api docs SimpleLineSymbol with style "none" means that line has no symbol. https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleLineSymbol.html#sty...

Despite that fill outline is still drawn like for a style 'solid'.

Codepen sample: https://codepen.io/mateusz-olsztyski/pen/NWOxrvE 

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

This issue will be fixed at version 4.27. You can test the fix by pointing your codepen to our next version. 

View solution in original post

3 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

We will look into this issue. You can use set the outline to be null as shown below and it will work. 

 

  const fillSymbol = {
    type: "simple-fill",
    color: [227, 139, 79, 1],
    outline: null
  };

Thanks,

-Undral

0 Kudos
JoelBennett
MVP Regular Contributor

This problem has existed since 4.22 and lies in the esri/symbols/cim/CIMSymbolHelper module, particularly in the fromSimpleFillSymbol function:

        d.fromSimpleFillSymbol = function(a) {
            const {color: c, style: b, outline: e} = a;
            a = [];
            const g = {
                type: "CIMPolygonSymbol",
                symbolLayers: a
            };
            var f = null;
            if (e) {
                const {cap: k, join: l, style: h} = e;
                "solid" !== h && "none" !== h && "esriSLSSolid" !== h && "esriSLSNull" !== h && (f = [{
                    type: "CIMGeometricEffectDashes",
                    dashTemplate: R(h, k),
                    lineDashEnding: "NoConstraint",
                    scaleDash: !0,
                    offsetAlongLine: null
                }]);
                a.push({
                    type: "CIMSolidStroke",
                    color: u(e.color),
                    capStyle: P(k),
                    joinStyle: Q(l),
                    miterLimit: e.miterLimit,
                    width: e.width,
                    effects: f
                })
            }
            //etc
        };

 

The problem lies with line 9 of what's shown above; it should instead be something like:

            if ((e) && (e.style != "none") && (e.style != "esriSLSNull")) {

 

Until this is fixed, the style "none" for SimpleFillSymbol outlines will be ignored.  Another workaround, in addition to the one Undral mentioned, is to set your line symbol's opacity to zero (see line 7 below):

  const fillSymbol = {
    type: "simple-fill",
    color: [227, 139, 79, 1],
    outline: {
      type: "simple-line",
      style: "none",
      color: [255,0,0,0],
      width: 5
    }
  };

 

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi there, 

This issue will be fixed at version 4.27. You can test the fix by pointing your codepen to our next version.