Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use color of entity even no corresponding layer is found #139

Closed
apriljunge opened this issue Apr 10, 2024 · 2 comments
Closed

Use color of entity even no corresponding layer is found #139

apriljunge opened this issue Apr 10, 2024 · 2 comments

Comments

@apriljunge
Copy link
Contributor

In .toPolyLines() the color of the entity is only parsed when a matching layer is found.
If theres no layer found, the color is set to black even when the entity has an color attribute. Is this intended?

dxf/src/toPolylines.js

Lines 14 to 25 in 9895f4f

if (layerTable) {
const colorNumber =
'colorNumber' in entity ? entity.colorNumber : layerTable.colorNumber
rgb = colors[colorNumber]
if (rgb === undefined) {
logger.warn('Color index', colorNumber, 'invalid, defaulting to black')
rgb = [0, 0, 0]
}
} else {
logger.warn('no layer table for layer:' + entity.layer)
rgb = [0, 0, 0]
}

@skymakerolof
Copy link
Owner

It seems strange that the color attribute of the entity is only parsed when a matching layer is found, and defaults to black otherwise, even if the entity has a specified color. I'm not entirely sure about the intended behavior here, but it does raise some questions. A pull request to address this would be welcome.

@skymakerolof
Copy link
Owner

#140 Released as 5.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants