@mlightcad/libredwg-web 0.6.3 → 0.6.4

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.
@@ -6928,7 +6928,7 @@ class LibreEntityConverter {
6928
6928
  const libredwg = this.libredwg;
6929
6929
  const color = libredwg.dwg_object_entity_get_color_object(entity);
6930
6930
  const method = color.method;
6931
- let colorIndex = color.index;
6931
+ const colorIndex = color.index;
6932
6932
  let rgbColor = void 0;
6933
6933
  if (method == 194 || (color.rgb >>> 24 & 255) === 194) {
6934
6934
  rgbColor = color.rgb & 16777215;
@@ -7143,20 +7143,24 @@ class LibreDwgConverter {
7143
7143
  bmpPreview = uint8ArrayToHexString(bmpPreviewBinaryData);
7144
7144
  }
7145
7145
  let entities = this.convertEntities(obj, commonAttrs.handle);
7146
- if (entities.length == 0) {
7147
- const entities_ptr = libredwg.dwg_dynapi_entity_value(item, "entities").data;
7148
- const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(
7149
- entities_ptr,
7150
- num_owned
7151
- );
7152
- const converter = this.entityConverter;
7146
+ if (!entities || entities.length == 0) {
7153
7147
  entities = [];
7154
- for (let index = 0; index < num_owned; index++) {
7155
- const object = libredwg.dwg_ref_get_object(object_ref_ptr_array[index]);
7156
- const entity = converter.convert(object);
7157
- if (entity) {
7158
- entity.ownerBlockRecordSoftId = commonAttrs.handle;
7159
- entities.push(entity);
7148
+ const entities_ptr = libredwg.dwg_dynapi_entity_value(item, "entities").data;
7149
+ if (entities_ptr) {
7150
+ const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(
7151
+ entities_ptr,
7152
+ num_owned
7153
+ );
7154
+ const converter = this.entityConverter;
7155
+ for (let index = 0; index < num_owned; index++) {
7156
+ const object = libredwg.dwg_ref_get_object(
7157
+ object_ref_ptr_array[index]
7158
+ );
7159
+ const entity = converter.convert(object);
7160
+ if (entity) {
7161
+ entity.ownerBlockRecordSoftId = commonAttrs.handle;
7162
+ entities.push(entity);
7163
+ }
7160
7164
  }
7161
7165
  }
7162
7166
  }
@@ -6933,7 +6933,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
6933
6933
  const libredwg = this.libredwg;
6934
6934
  const color = libredwg.dwg_object_entity_get_color_object(entity);
6935
6935
  const method = color.method;
6936
- let colorIndex = color.index;
6936
+ const colorIndex = color.index;
6937
6937
  let rgbColor = void 0;
6938
6938
  if (method == 194 || (color.rgb >>> 24 & 255) === 194) {
6939
6939
  rgbColor = color.rgb & 16777215;
@@ -7148,20 +7148,24 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
7148
7148
  bmpPreview = uint8ArrayToHexString(bmpPreviewBinaryData);
7149
7149
  }
7150
7150
  let entities = this.convertEntities(obj, commonAttrs.handle);
7151
- if (entities.length == 0) {
7152
- const entities_ptr = libredwg.dwg_dynapi_entity_value(item, "entities").data;
7153
- const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(
7154
- entities_ptr,
7155
- num_owned
7156
- );
7157
- const converter = this.entityConverter;
7151
+ if (!entities || entities.length == 0) {
7158
7152
  entities = [];
7159
- for (let index = 0; index < num_owned; index++) {
7160
- const object = libredwg.dwg_ref_get_object(object_ref_ptr_array[index]);
7161
- const entity = converter.convert(object);
7162
- if (entity) {
7163
- entity.ownerBlockRecordSoftId = commonAttrs.handle;
7164
- entities.push(entity);
7153
+ const entities_ptr = libredwg.dwg_dynapi_entity_value(item, "entities").data;
7154
+ if (entities_ptr) {
7155
+ const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(
7156
+ entities_ptr,
7157
+ num_owned
7158
+ );
7159
+ const converter = this.entityConverter;
7160
+ for (let index = 0; index < num_owned; index++) {
7161
+ const object = libredwg.dwg_ref_get_object(
7162
+ object_ref_ptr_array[index]
7163
+ );
7164
+ const entity = converter.convert(object);
7165
+ if (entity) {
7166
+ entity.ownerBlockRecordSoftId = commonAttrs.handle;
7167
+ entities.push(entity);
7168
+ }
7165
7169
  }
7166
7170
  }
7167
7171
  }
@@ -203,18 +203,20 @@ export class LibreDwgConverter {
203
203
  // I guess it is one bug on libredwg. I logged [one bug](https://github.com/LibreDWG/libredwg/issues/1199)
204
204
  // on libredwg too. In this time, I try to use property 'entities' of block header to iterate entities.
205
205
  let entities = this.convertEntities(obj, commonAttrs.handle);
206
- if (entities.length == 0) {
206
+ if (!entities || entities.length == 0) {
207
+ entities = [];
207
208
  const entities_ptr = libredwg.dwg_dynapi_entity_value(item, 'entities')
208
209
  .data;
209
- const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(entities_ptr, num_owned);
210
- const converter = this.entityConverter;
211
- entities = [];
212
- for (let index = 0; index < num_owned; index++) {
213
- const object = libredwg.dwg_ref_get_object(object_ref_ptr_array[index]);
214
- const entity = converter.convert(object);
215
- if (entity) {
216
- entity.ownerBlockRecordSoftId = commonAttrs.handle;
217
- entities.push(entity);
210
+ if (entities_ptr) {
211
+ const object_ref_ptr_array = libredwg.dwg_ptr_to_object_ref_ptr_array(entities_ptr, num_owned);
212
+ const converter = this.entityConverter;
213
+ for (let index = 0; index < num_owned; index++) {
214
+ const object = libredwg.dwg_ref_get_object(object_ref_ptr_array[index]);
215
+ const entity = converter.convert(object);
216
+ if (entity) {
217
+ entity.ownerBlockRecordSoftId = commonAttrs.handle;
218
+ entities.push(entity);
219
+ }
218
220
  }
219
221
  }
220
222
  }
@@ -1568,7 +1568,7 @@ export class LibreEntityConverter {
1568
1568
  // - 0xc5 for foreground color
1569
1569
  // - 0xc8 for none (also c3 and rgb of 0x101)
1570
1570
  const method = color.method;
1571
- let colorIndex = color.index;
1571
+ const colorIndex = color.index;
1572
1572
  let rgbColor = undefined;
1573
1573
  if (method == 0xc2 || ((color.rgb >>> 24) & 0xff) === 0xc2) {
1574
1574
  rgbColor = color.rgb & 0x00ffffff;
@@ -1,5 +1,5 @@
1
- import { DwgAttachmentPoint, DwgTextHorizontalAlign } from '../database';
2
1
  import { isModelSpace } from '../converter/utils';
2
+ import { DwgAttachmentPoint, DwgTextHorizontalAlign } from '../database';
3
3
  import { Box2D } from './box2d';
4
4
  import { evaluateBSpline } from './bspline';
5
5
  import { Color } from './color';
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.3",
6
+ "version": "0.6.4",
7
7
  "author": "MLight Lee <mlight.lee@outlook.com>",
8
8
  "type": "module",
9
9
  "repository": {