File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 "description" : " A DWG/DXF JavaScript parser based on libredwg" ,
44 "license" : " GPL-2.0-only" ,
55 "private" : false ,
6- "version" : " 0.6.7 " ,
6+ "version" : " 0.6.9 " ,
77 "author" : " MLight Lee <mlight.lee@outlook.com>" ,
88 "type" : " module" ,
99 "repository" : {
Original file line number Diff line number Diff line change @@ -655,12 +655,15 @@ export class LibreDwgConverter {
655655 const method = color . method
656656 let colorIndex = 256
657657 let rgbColor = 0xffffff
658- // It looks like that libredwg always returns 256 for property 'index' in Dwg_Color
659- if ( method === 0xc3 || ( ( color . rgb >>> 24 ) & 0xff ) === 0xc3 ) {
660- colorIndex = color . rgb & 0x000000ff
661- } else if ( method == 0xc2 || ( ( color . rgb >>> 24 ) & 0xff ) === 0xc2 ) {
662- rgbColor = color . rgb & 0x00ffffff
663- }
658+ // NOTE: Some older DWG formats use method=0x0 and provide the ACI index via color.index.
659+ if ( method === 0xc3 || ( ( color . rgb >>> 24 ) & 0xff ) === 0xc3 ) {
660+ colorIndex = color . rgb & 0x000000ff
661+ } else if ( method == 0xc2 || ( ( color . rgb >>> 24 ) & 0xff ) === 0xc2 ) {
662+ rgbColor = color . rgb & 0x00ffffff
663+ } else if ( color . index >= 1 && color . index <= 255 ) {
664+ // Older DWG format: ACI index is directly available in color.index.
665+ colorIndex = color . index
666+ }
664667
665668 return {
666669 ...commonAttrs ,
Original file line number Diff line number Diff line change @@ -692,7 +692,7 @@ export class SvgConverter {
692692 color . color = entity . color
693693 }
694694
695- // If it is white color, convert it to black because the background of svg is white
695+ // ACI 7 is one background-dependent color
696696 if ( color . colorIndex == 7 ) {
697697 color . colorIndex = 256
698698 }
You can’t perform that action at this time.
0 commit comments