@mlightcad/libredwg-web 0.6.7 → 0.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7505,6 +7505,8 @@ class LibreDwgConverter {
7505
7505
  colorIndex = color.rgb & 255;
7506
7506
  } else if (method == 194 || (color.rgb >>> 24 & 255) === 194) {
7507
7507
  rgbColor = color.rgb & 16777215;
7508
+ } else if (color.index >= 1 && color.index <= 255) {
7509
+ colorIndex = color.index;
7508
7510
  }
7509
7511
  return {
7510
7512
  ...commonAttrs,
@@ -7510,6 +7510,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
7510
7510
  colorIndex = color.rgb & 255;
7511
7511
  } else if (method == 194 || (color.rgb >>> 24 & 255) === 194) {
7512
7512
  rgbColor = color.rgb & 16777215;
7513
+ } else if (color.index >= 1 && color.index <= 255) {
7514
+ colorIndex = color.index;
7513
7515
  }
7514
7516
  return {
7515
7517
  ...commonAttrs,
@@ -565,13 +565,17 @@ export class LibreDwgConverter {
565
565
  const method = color.method;
566
566
  let colorIndex = 256;
567
567
  let rgbColor = 0xffffff;
568
- // It looks like that libredwg always returns 256 for property 'index' in Dwg_Color
568
+ // NOTE: Some older DWG formats use method=0x0 and provide the ACI index via color.index.
569
569
  if (method === 0xc3 || ((color.rgb >>> 24) & 0xff) === 0xc3) {
570
570
  colorIndex = color.rgb & 0x000000ff;
571
571
  }
572
572
  else if (method == 0xc2 || ((color.rgb >>> 24) & 0xff) === 0xc2) {
573
573
  rgbColor = color.rgb & 0x00ffffff;
574
574
  }
575
+ else if (color.index >= 1 && color.index <= 255) {
576
+ // Older DWG format: ACI index is directly available in color.index.
577
+ colorIndex = color.index;
578
+ }
575
579
  return {
576
580
  ...commonAttrs,
577
581
  standardFlag: flag,
@@ -475,7 +475,7 @@ export class SvgConverter {
475
475
  else if (entity.color != null) {
476
476
  color.color = entity.color;
477
477
  }
478
- // If it is white color, convert it to black because the background of svg is white
478
+ // ACI 7 is one background-dependent color
479
479
  if (color.colorIndex == 7) {
480
480
  color.colorIndex = 256;
481
481
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A DWG/DXF JavaScript parser based on libredwg",
4
4
  "license": "GPL-2.0-only",
5
5
  "private": false,
6
- "version": "0.6.7",
6
+ "version": "0.6.9",
7
7
  "author": "MLight Lee <mlight.lee@outlook.com>",
8
8
  "type": "module",
9
9
  "repository": {