Skip to content

Commit

Permalink
Stored the AutoCad color index in the layer data, updated tests to ex…
Browse files Browse the repository at this point in the history
…pect additional data
  • Loading branch information
Serthys committed May 14, 2018
1 parent dc14930 commit c28177c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dist/dxf-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,8 @@ DxfParser.prototype._parse = function(dxfString) {
case 62: // color, visibility
layer.visible = curr.value >= 0;
// TODO 0 and 256 are BYBLOCK and BYLAYER respectively. Need to handle these values for layers?.
layer.color = getAcadColor(Math.abs(curr.value));
layer.colorIndex = Math.abs(curr.value);
layer.color = getAcadColor(layer.colorIndex);
curr = scanner.next();
break;
case 70: // frozen layer
Expand Down
3 changes: 2 additions & 1 deletion lib/DxfParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,8 @@ DxfParser.prototype._parse = function(dxfString) {
case 62: // color, visibility
layer.visible = curr.value >= 0;
// TODO 0 and 256 are BYBLOCK and BYLAYER respectively. Need to handle these values for layers?.
layer.color = getAcadColor(Math.abs(curr.value));
layer.colorIndex = Math.abs(curr.value);
layer.color = getAcadColor(layer.colorIndex);
curr = scanner.next();
break;
case 70: // frozen layer
Expand Down
1 change: 1 addition & 0 deletions test/data/extendeddata.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,7 @@
"name": "0",
"frozen": false,
"visible": true,
"colorIndex": 7,
"color": 16777215
}
}
Expand Down
2 changes: 2 additions & 0 deletions test/data/layer-table.expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
"frozen": false,
"name": "0",
"visible": true,
"colorIndex": 7,
"color": 16777215
},
"Layer 1": {
"frozen": true,
"name": "Layer 1",
"visible": true,
"colorIndex": 7,
"color": 16777215
}
}
Expand Down

0 comments on commit c28177c

Please sign in to comment.