Paths without borders are occasionally shown that they have borders

Issue

Path’s strokeEnabled property shows as true on a specific image.

Steps to reproduce

  • Outline stroke the yellow circle

  • Code:

      node.forEach(function (childNode, i) {
         if (childNode.strokeEnabled) {
             //do one thing 
         } else {
             //kep the original path
       }
    });
    

Expected Behavior

A similar circle (the red one, the smaller one), doesn’t have a border when performing outline stroke - doesn’t error and doesn’t modify the shape.

Actual Behavior

When outlining the yellow (big) circle this will give you the “cannot read property ‘value’ of null”. This is related to creating a new element with the same border colour on scenegraph and the colour missing. The circle does not have a border. Thus, it should not be trying to create objects from that border.

Additional information

Circle that errors.xd (17.7 KB)

It doesn’t happen with anything else :confused:

could you attach the block of code you are using?

Added above :slight_smile: I’ve omitted the operations I do, but it generally returns true with the yellow circle

Did you create the yellow circle directly in XD or pasted it from Illustrator?

I believe my testers imported it from Illustrator.

Ok.
Applied on a shape created into XD it returns strokeEnabled property correctly, but if applied on an object imported from Illustrator it first returns true even if it has no border: check then uncheck the Border option in the properties panel will solve.

Thanks @PaoloBiagini for replying to @Irina :+1:

Is it something that can be fixed in XD? It’s not something we can explain to XD users as they will just say “so what”? :wink:

2 Likes

It’s possible for strokeEnabled to be true but stroke is null (no stroke drawn) or stroke has opacity = 0% (the stroke occupies pixels for hit-testing purposes but is invisible).

See docs for stroke:

If this property is null or strokeEnabled is false, no stroke is drawn.

@peterflynn I do that anyway, however, it is also possible for the strokeEnabled to be false, and the opacity to be 0 and stroke to be null too, which unfirtunately renders opacity = 1 useless. :pensive: