@mlightcad/libredwg-web 0.4.4 → 0.4.5

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.
@@ -7251,7 +7251,8 @@ class LibreDwgConverter {
7251
7251
  const description = libredwg.dwg_dynapi_entity_value(item, "description").data;
7252
7252
  const numDashes = libredwg.dwg_dynapi_entity_value(item, "numdashes").data;
7253
7253
  const patternLen = libredwg.dwg_dynapi_entity_value(item, "pattern_len").data;
7254
- const dashArray = [];
7254
+ const dashes = libredwg.dwg_dynapi_entity_value(item, "dashes").data;
7255
+ const dashArray = dashes ? libredwg.dwg_ptr_to_ltype_dash_array(dashes, numDashes) : [];
7255
7256
  return {
7256
7257
  ...commonAttrs,
7257
7258
  description,
@@ -7266,7 +7267,15 @@ class LibreDwgConverter {
7266
7267
  dashes.forEach((dash) => {
7267
7268
  patterns.push({
7268
7269
  elementLength: dash.length || 0,
7269
- elementTypeFlag: 0
7270
+ elementTypeFlag: dash.complex_shapecode,
7271
+ shapeNumber: dash.shape_flag,
7272
+ // TODO: convert style handle to style object id
7273
+ // styleObjectId: dash.style,
7274
+ scale: dash.scale,
7275
+ rotation: dash.rotation,
7276
+ offsetX: dash.x_offset,
7277
+ offsetY: dash.y_offset,
7278
+ text: dash.text
7270
7279
  });
7271
7280
  });
7272
7281
  return patterns;
@@ -7256,7 +7256,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
7256
7256
  const description = libredwg.dwg_dynapi_entity_value(item, "description").data;
7257
7257
  const numDashes = libredwg.dwg_dynapi_entity_value(item, "numdashes").data;
7258
7258
  const patternLen = libredwg.dwg_dynapi_entity_value(item, "pattern_len").data;
7259
- const dashArray = [];
7259
+ const dashes = libredwg.dwg_dynapi_entity_value(item, "dashes").data;
7260
+ const dashArray = dashes ? libredwg.dwg_ptr_to_ltype_dash_array(dashes, numDashes) : [];
7260
7261
  return {
7261
7262
  ...commonAttrs,
7262
7263
  description,
@@ -7271,7 +7272,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
7271
7272
  dashes.forEach((dash) => {
7272
7273
  patterns.push({
7273
7274
  elementLength: dash.length || 0,
7274
- elementTypeFlag: 0
7275
+ elementTypeFlag: dash.complex_shapecode,
7276
+ shapeNumber: dash.shape_flag,
7277
+ // TODO: convert style handle to style object id
7278
+ // styleObjectId: dash.style,
7279
+ scale: dash.scale,
7280
+ rotation: dash.rotation,
7281
+ offsetX: dash.x_offset,
7282
+ offsetY: dash.y_offset,
7283
+ text: dash.text
7275
7284
  });
7276
7285
  });
7277
7286
  return patterns;
@@ -540,9 +540,8 @@ export class LibreDwgConverter {
540
540
  .data;
541
541
  const patternLen = libredwg.dwg_dynapi_entity_value(item, 'pattern_len')
542
542
  .data;
543
- // const dashes = libredwg.dwg_dynapi_entity_value(item, 'dashes').data as Dwg_Array_Ptr
544
- // const dashArray = dashes ? libredwg.dwg_ptr_to_ltype_dash_array(dashes, numDashes) : []
545
- const dashArray = [];
543
+ const dashes = libredwg.dwg_dynapi_entity_value(item, 'dashes').data;
544
+ const dashArray = dashes ? libredwg.dwg_ptr_to_ltype_dash_array(dashes, numDashes) : [];
546
545
  return {
547
546
  ...commonAttrs,
548
547
  description: description,
@@ -555,10 +554,17 @@ export class LibreDwgConverter {
555
554
  convertLineTypePattern(dashes) {
556
555
  const patterns = [];
557
556
  dashes.forEach(dash => {
558
- // For now always convert complex line type to simple line type
559
557
  patterns.push({
560
558
  elementLength: dash.length || 0,
561
- elementTypeFlag: 0
559
+ elementTypeFlag: dash.complex_shapecode,
560
+ shapeNumber: dash.shape_flag,
561
+ // TODO: convert style handle to style object id
562
+ // styleObjectId: dash.style,
563
+ scale: dash.scale,
564
+ rotation: dash.rotation,
565
+ offsetX: dash.x_offset,
566
+ offsetY: dash.y_offset,
567
+ text: dash.text
562
568
  });
563
569
  });
564
570
  return patterns;
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.4.4",
6
+ "version": "0.4.5",
7
7
  "author": "MLight Lee <mlight.lee@outlook.com>",
8
8
  "type": "module",
9
9
  "repository": {