@design-core/core 0.0.7 → 51.1.0

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.
Files changed (117) hide show
  1. package/.github/workflows/DesignCoreQA.yml +3 -0
  2. package/core/designCore.js +1 -1
  3. package/core/dimensions/alignedDimension.js +7 -7
  4. package/core/dimensions/angularDimension.js +32 -32
  5. package/core/dimensions/{baseCircularDimension.js → circularDimensionBase.js} +19 -19
  6. package/core/dimensions/diametricDimension.js +10 -10
  7. package/core/dimensions/dimension.js +42 -42
  8. package/core/dimensions/{baseDimension.js → dimensionBase.js} +17 -17
  9. package/core/dimensions/{baseLinearDimension.js → linearDimensionBase.js} +9 -9
  10. package/core/dimensions/radialDimension.js +8 -8
  11. package/core/dimensions/rotatedDimension.js +8 -8
  12. package/core/entities/arc.js +22 -22
  13. package/core/entities/arctext.js +13 -13
  14. package/core/entities/circle.js +7 -7
  15. package/core/entities/hatch.js +210 -40
  16. package/core/entities/insert.js +11 -6
  17. package/core/entities/point.js +19 -19
  18. package/core/entities/polyline.js +3 -3
  19. package/core/entities/{basePolyline.js → polylineBase.js} +18 -18
  20. package/core/entities/text.js +4 -4
  21. package/core/lib/boundingBox.js +11 -11
  22. package/core/lib/canvas.js +13 -6
  23. package/core/lib/clipboard.js +2 -2
  24. package/core/lib/dxf/dxf.js +11 -11
  25. package/core/lib/dxf/dxfIterator.js +2 -2
  26. package/core/lib/entityManager.js +19 -19
  27. package/core/lib/inputManager.js +1 -1
  28. package/core/lib/matrix.js +1 -1
  29. package/core/lib/patterns.js +1 -1
  30. package/core/lib/polylineUtils.js +9 -9
  31. package/core/lib/renderers/cairoRenderer.js +5 -5
  32. package/core/lib/renderers/canvasRenderer.js +4 -4
  33. package/core/lib/renderers/pdfRenderer.js +7 -7
  34. package/core/lib/renderers/rendererBase.js +1 -1
  35. package/core/lib/scene.js +1 -1
  36. package/core/lib/selectionManager.js +18 -18
  37. package/core/lib/utils.js +5 -5
  38. package/core/properties/entityProperties.js +2 -1
  39. package/core/properties/flags.js +12 -0
  40. package/core/properties/property.js +8 -3
  41. package/core/properties/propertyManager.js +52 -37
  42. package/core/tables/block.js +50 -46
  43. package/core/tables/dimStyle.js +5 -5
  44. package/core/tables/ltypeManager.js +1 -1
  45. package/core/tables/vport.js +2 -2
  46. package/core/tools/chamfer.js +6 -6
  47. package/core/tools/chamferFilletBase.js +4 -4
  48. package/core/tools/copy.js +8 -8
  49. package/core/tools/copybase.js +3 -3
  50. package/core/tools/copyclip.js +3 -3
  51. package/core/tools/cornerEntity.js +2 -2
  52. package/core/tools/cutclip.js +3 -3
  53. package/core/tools/explode.js +6 -6
  54. package/core/tools/extend.js +13 -13
  55. package/core/tools/fillet.js +6 -6
  56. package/core/tools/matchProp.js +1 -1
  57. package/core/tools/mirror.js +11 -11
  58. package/core/tools/move.js +5 -5
  59. package/core/tools/offset.js +29 -29
  60. package/core/tools/purge.js +10 -10
  61. package/core/tools/rotate.js +16 -16
  62. package/core/tools/scale.js +6 -6
  63. package/core/tools/trim.js +15 -15
  64. package/cspell.json +323 -0
  65. package/package.json +1 -1
  66. package/test/dimensions/alignedDimension.test.js +3 -3
  67. package/test/dimensions/angularDimension.test.js +7 -7
  68. package/test/dimensions/diametricDimension.test.js +9 -9
  69. package/test/dimensions/dimension.test.js +12 -12
  70. package/test/dimensions/{baseDimension.test.js → dimensionBase.test.js} +12 -12
  71. package/test/dimensions/{baseLinearDimension.test.js → linearDimensionBase.test.js} +7 -7
  72. package/test/dimensions/radialDimension.test.js +9 -9
  73. package/test/dimensions/rotatedDimension.test.js +4 -4
  74. package/test/entities/arc.test.js +10 -10
  75. package/test/entities/arctext.test.js +6 -6
  76. package/test/entities/circle.test.js +18 -18
  77. package/test/entities/hatch.test.js +362 -39
  78. package/test/entities/insert.test.js +9 -9
  79. package/test/entities/point.test.js +3 -3
  80. package/test/entities/{basePolyline.test.js → polylineBase.test.js} +131 -62
  81. package/test/entities/text.test.js +19 -19
  82. package/test/integration/exportIntegration.test.js +3 -3
  83. package/test/integration/userInputIntegration.test.js +5 -5
  84. package/test/lib/boundingBox.test.js +3 -3
  85. package/test/lib/canvas.test.js +9 -9
  86. package/test/lib/clipboard.test.js +73 -0
  87. package/test/lib/inputManager.test.js +4 -4
  88. package/test/lib/scene.test.js +9 -9
  89. package/test/lib/selectionManager.test.js +3 -3
  90. package/test/lib/snapping.test.js +1 -1
  91. package/test/properties/flags.test.js +24 -0
  92. package/test/properties/propertyManager.test.js +93 -22
  93. package/test/renderers/pdfRenderer.test.js +2 -2
  94. package/test/tables/block.test.js +63 -14
  95. package/test/tables/layerManager.test.js +2 -2
  96. package/test/test-helpers/hatchGridRenderer.js +3 -3
  97. package/test/test-helpers/test-helpers.js +6 -6
  98. package/test/tools/chamfer.test.js +60 -60
  99. package/test/tools/chamferFilletBase.test.js +36 -36
  100. package/test/tools/copy.test.js +6 -6
  101. package/test/tools/copybase.test.js +2 -2
  102. package/test/tools/copyclip.test.js +2 -2
  103. package/test/tools/cornerEntity.test.js +8 -8
  104. package/test/tools/cutclip.test.js +2 -2
  105. package/test/tools/erase.test.js +6 -6
  106. package/test/tools/explode.test.js +2 -2
  107. package/test/tools/extend.test.js +84 -84
  108. package/test/tools/fillet.test.js +62 -62
  109. package/test/tools/matchProp.test.js +6 -6
  110. package/test/tools/mirror.test.js +26 -26
  111. package/test/tools/move.test.js +7 -7
  112. package/test/tools/offset.test.js +65 -65
  113. package/test/tools/purge.test.js +4 -4
  114. package/test/tools/rotate.test.js +10 -10
  115. package/test/tools/scale.test.js +28 -28
  116. package/test/tools/trim.test.js +109 -109
  117. package/test/tools/zoom.test.js +15 -17
@@ -11,8 +11,8 @@ const core = new Core();
11
11
 
12
12
  test('ChamferFilletBase.resolveCornerGeometry returns false and notifies when first segment is not a Line', () => {
13
13
  core.scene.clear();
14
- core.scene.addItem('Circle', { points: [new Point(0, 0), new Point(5, 0)] });
15
- core.scene.addItem('Line', { points: [new Point(0, 0), new Point(0, 10)] });
14
+ core.scene.addEntity('Circle', { points: [new Point(0, 0), new Point(5, 0)] });
15
+ core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(0, 10)] });
16
16
 
17
17
  const notifySpy = jest.spyOn(core, 'notify');
18
18
  const chamfer = new Chamfer();
@@ -28,8 +28,8 @@ test('ChamferFilletBase.resolveCornerGeometry returns false and notifies when fi
28
28
 
29
29
  test('ChamferFilletBase.resolveCornerGeometry returns false and notifies when second segment is not a Line', () => {
30
30
  core.scene.clear();
31
- core.scene.addItem('Line', { points: [new Point(0, 0), new Point(10, 0)] });
32
- core.scene.addItem('Circle', { points: [new Point(0, 0), new Point(5, 0)] });
31
+ core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(10, 0)] });
32
+ core.scene.addEntity('Circle', { points: [new Point(0, 0), new Point(5, 0)] });
33
33
 
34
34
  const notifySpy = jest.spyOn(core, 'notify');
35
35
  const chamfer = new Chamfer();
@@ -45,8 +45,8 @@ test('ChamferFilletBase.resolveCornerGeometry returns false and notifies when se
45
45
 
46
46
  test('ChamferFilletBase.resolveCornerGeometry returns false and notifies for parallel lines', () => {
47
47
  core.scene.clear();
48
- core.scene.addItem('Line', { points: [new Point(0, 0), new Point(10, 0)] });
49
- core.scene.addItem('Line', { points: [new Point(0, 2), new Point(10, 2)] });
48
+ core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(10, 0)] });
49
+ core.scene.addEntity('Line', { points: [new Point(0, 2), new Point(10, 2)] });
50
50
 
51
51
  const notifySpy = jest.spyOn(core, 'notify');
52
52
  const chamfer = new Chamfer();
@@ -63,8 +63,8 @@ test('ChamferFilletBase.resolveCornerGeometry returns false and notifies for par
63
63
  test('ChamferFilletBase.resolveCornerGeometry returns false for collinear overlapping lines', () => {
64
64
  core.scene.clear();
65
65
  // Two segments on the same line that overlap
66
- core.scene.addItem('Line', { points: [new Point(0, 0), new Point(10, 0)] });
67
- core.scene.addItem('Line', { points: [new Point(5, 0), new Point(15, 0)] });
66
+ core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(10, 0)] });
67
+ core.scene.addEntity('Line', { points: [new Point(5, 0), new Point(15, 0)] });
68
68
 
69
69
  const notifySpy = jest.spyOn(core, 'notify');
70
70
  const chamfer = new Chamfer();
@@ -81,8 +81,8 @@ test('ChamferFilletBase.resolveCornerGeometry returns false for collinear overla
81
81
  test('ChamferFilletBase.resolveCornerGeometry returns false for collinear endpoint-sharing lines', () => {
82
82
  core.scene.clear();
83
83
  // Two collinear segments sharing an endpoint (180° angle)
84
- core.scene.addItem('Line', { points: [new Point(0, 0), new Point(5, 0)] });
85
- core.scene.addItem('Line', { points: [new Point(5, 0), new Point(10, 0)] });
84
+ core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(5, 0)] });
85
+ core.scene.addEntity('Line', { points: [new Point(5, 0), new Point(10, 0)] });
86
86
 
87
87
  const notifySpy = jest.spyOn(core, 'notify');
88
88
  const chamfer = new Chamfer();
@@ -99,8 +99,8 @@ test('ChamferFilletBase.resolveCornerGeometry returns false for collinear endpoi
99
99
  test('ChamferFilletBase.resolveCornerGeometry returns true and computes intersection for L-corner', () => {
100
100
  // Horizontal (-10,0)→(0,0) and vertical (0,0)→(0,10); infinite lines meet at (0,0)
101
101
  core.scene.clear();
102
- core.scene.addItem('Line', { points: [new Point(-10, 0), new Point(0, 0)] });
103
- core.scene.addItem('Line', { points: [new Point(0, 0), new Point(0, 10)] });
102
+ core.scene.addEntity('Line', { points: [new Point(-10, 0), new Point(0, 0)] });
103
+ core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(0, 10)] });
104
104
 
105
105
  const chamfer = new Chamfer();
106
106
  chamfer.firstPick.entity = core.scene.entities.get(0);
@@ -125,8 +125,8 @@ test('ChamferFilletBase.resolveCornerGeometry uses polyline activeSeg for first
125
125
  // Polyline [(-10,0),(0,0),(0,10)], click near segment 1 (y=0).
126
126
  // Paired with vertical line x=5; lines meet at (5,0).
127
127
  core.scene.clear();
128
- core.scene.addItem('Lwpolyline', { points: [new Point(-10, 0), new Point(0, 0), new Point(0, 10)] });
129
- core.scene.addItem('Line', { points: [new Point(5, -5), new Point(5, 5)] });
128
+ core.scene.addEntity('Lwpolyline', { points: [new Point(-10, 0), new Point(0, 0), new Point(0, 10)] });
129
+ core.scene.addEntity('Line', { points: [new Point(5, -5), new Point(5, 5)] });
130
130
 
131
131
  const polyEntity = core.scene.entities.get(0);
132
132
  const lineEntity = core.scene.entities.get(1);
@@ -151,8 +151,8 @@ test('ChamferFilletBase.applySharpTrim trims two Lines to the intersection point
151
151
  // Line1: (0,0)→(8,0); Line2: (10,-10)→(10,-2). Infinite lines meet at (10,0).
152
152
  // keepEnd for Line1 = (0,0); keepEnd for Line2 = (10,-10).
153
153
  core.scene.clear();
154
- core.scene.addItem('Line', { points: [new Point(0, 0), new Point(8, 0)] });
155
- core.scene.addItem('Line', { points: [new Point(10, -10), new Point(10, -2)] });
154
+ core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(8, 0)] });
155
+ core.scene.addEntity('Line', { points: [new Point(10, -10), new Point(10, -2)] });
156
156
  const lineA = core.scene.entities.get(0);
157
157
  const lineB = core.scene.entities.get(1);
158
158
 
@@ -188,7 +188,7 @@ test('ChamferFilletBase.applySharpTrim poly+poly consecutive segments: replaces
188
188
  // L-shaped polyline [(-10,0),(0,0),(0,10)]; segments 1 and 2 share vertex (0,0).
189
189
  // Intersection of infinite lines is also (0,0), so splice replaces vertex with itself.
190
190
  core.scene.clear();
191
- core.scene.addItem('Lwpolyline', { points: [new Point(-10, 0), new Point(0, 0), new Point(0, 10)] });
191
+ core.scene.addEntity('Lwpolyline', { points: [new Point(-10, 0), new Point(0, 0), new Point(0, 10)] });
192
192
  const polyEntity = core.scene.entities.get(0);
193
193
 
194
194
  const chamfer = new Chamfer();
@@ -212,7 +212,7 @@ test('ChamferFilletBase.applySharpTrim poly+poly open ends: moves both endpoints
212
212
  // Seg 1 is on y=2, seg 3 (lastIdx=3) is on x=3 → infinite lines meet at (3,2).
213
213
  // Both open endpoints (index 0 and 3) are moved to (3,2).
214
214
  core.scene.clear();
215
- core.scene.addItem('Lwpolyline', { points: [new Point(-5, 2), new Point(0, 2), new Point(3, 4), new Point(3, 8)] });
215
+ core.scene.addEntity('Lwpolyline', { points: [new Point(-5, 2), new Point(0, 2), new Point(3, 4), new Point(3, 8)] });
216
216
  const polyEntity = core.scene.entities.get(0);
217
217
 
218
218
  const chamfer = new Chamfer();
@@ -247,7 +247,7 @@ test('ChamferFilletBase.applySharpTrim poly+poly closed polyline seg1+lastIdx: c
247
247
  // The shared corner is at index min(1,3)=1, so corner vertex (0,0) is replaced with
248
248
  // the intersection point (0,0) — a no-op on coordinates but proves the splice path ran.
249
249
  core.scene.clear();
250
- core.scene.addItem('Lwpolyline', { points: [new Point(-10, 0), new Point(0, 0), new Point(0, 10)] });
250
+ core.scene.addEntity('Lwpolyline', { points: [new Point(-10, 0), new Point(0, 0), new Point(0, 10)] });
251
251
  const polyEntity = core.scene.entities.get(0);
252
252
  polyEntity.flags.setFlagValue(1); // mark as closed
253
253
 
@@ -275,7 +275,7 @@ test('ChamferFilletBase.applySharpTrim closed poly last-regular-seg + closing-se
275
275
  // Corner at (0,10) shared by seg 3 and seg 4. segDiff=1 → corner-splice path.
276
276
  // cornerIdx = min(3,4) = 3 → replaces points[3]=(0,10) with intersectionPoint (0,10).
277
277
  core.scene.clear();
278
- core.scene.addItem('Lwpolyline', { points: [new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10)] });
278
+ core.scene.addEntity('Lwpolyline', { points: [new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10)] });
279
279
  const polyEntity = core.scene.entities.get(0);
280
280
  polyEntity.flags.setFlagValue(1);
281
281
 
@@ -303,7 +303,7 @@ test('ChamferFilletBase.applySharpTrim closed poly closing-seg + seg-1: replaces
303
303
  // segDiff = |4-1| = 3 (not 1), closing-wrap detected → cornerIdx = 0.
304
304
  // Replaces points[0]=(0,0) with intersectionPoint (0,0).
305
305
  core.scene.clear();
306
- core.scene.addItem('Lwpolyline', { points: [new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10)] });
306
+ core.scene.addEntity('Lwpolyline', { points: [new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10)] });
307
307
  const polyEntity = core.scene.entities.get(0);
308
308
  polyEntity.flags.setFlagValue(1);
309
309
 
@@ -336,8 +336,8 @@ test('ChamferFilletBase.applySharpTrim first=Line second=Poly keepStart: line co
336
336
  // second=Poly, segmentIndex=2 (segment (-10,0)→(0,0)), click left of intersection → keepStart.
337
337
  // Result: Poly becomes [(-20,0),(-10,0),(0,0),(0,10)]; Line removed.
338
338
  core.scene.clear();
339
- core.scene.addItem('Line', { points: [new Point(0, 0), new Point(0, 10)] });
340
- core.scene.addItem('Lwpolyline', { points: [new Point(-20, 0), new Point(-10, 0), new Point(0, 0), new Point(10, 0)] });
339
+ core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(0, 10)] });
340
+ core.scene.addEntity('Lwpolyline', { points: [new Point(-20, 0), new Point(-10, 0), new Point(0, 0), new Point(10, 0)] });
341
341
  const lineEntity = core.scene.entities.get(0);
342
342
  const polyEntity = core.scene.entities.get(1);
343
343
 
@@ -374,8 +374,8 @@ test('ChamferFilletBase.applySharpTrim first=Line second=Poly keepEnd: line cons
374
374
  // Same setup, but segmentIndex=3. click right of intersection → keepEnd.
375
375
  // Result: Poly becomes [(0,10),(0,0),(10,0)]; Line removed.
376
376
  core.scene.clear();
377
- core.scene.addItem('Line', { points: [new Point(0, 0), new Point(0, 10)] });
378
- core.scene.addItem('Lwpolyline', { points: [new Point(-20, 0), new Point(-10, 0), new Point(0, 0), new Point(10, 0)] });
377
+ core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(0, 10)] });
378
+ core.scene.addEntity('Lwpolyline', { points: [new Point(-20, 0), new Point(-10, 0), new Point(0, 0), new Point(10, 0)] });
379
379
  const lineEntity = core.scene.entities.get(0);
380
380
  const polyEntity = core.scene.entities.get(1);
381
381
 
@@ -413,8 +413,8 @@ test('ChamferFilletBase.applySharpTrim first=Poly second=Line: poly/line orderin
413
413
  // firstIsPolyline=true → [poly, line] = [this.firstPick, this.secondPick].
414
414
  // Result should be the same: Poly becomes [(-20,0),(-10,0),(0,0),(0,10)]; Line removed.
415
415
  core.scene.clear();
416
- core.scene.addItem('Lwpolyline', { points: [new Point(-20, 0), new Point(-10, 0), new Point(0, 0), new Point(10, 0)] });
417
- core.scene.addItem('Line', { points: [new Point(0, 0), new Point(0, 10)] });
416
+ core.scene.addEntity('Lwpolyline', { points: [new Point(-20, 0), new Point(-10, 0), new Point(0, 0), new Point(10, 0)] });
417
+ core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(0, 10)] });
418
418
  const polyEntity = core.scene.entities.get(0);
419
419
  const lineEntity = core.scene.entities.get(1);
420
420
 
@@ -454,7 +454,7 @@ test('ChamferFilletBase.validateSelection returns null when firstPick has no ent
454
454
 
455
455
  test('ChamferFilletBase.validateSelection returns null when firstPick entity is not a Line', () => {
456
456
  core.scene.clear();
457
- core.scene.addItem('Circle', { points: [new Point(0, 0), new Point(5, 0)] });
457
+ core.scene.addEntity('Circle', { points: [new Point(0, 0), new Point(5, 0)] });
458
458
 
459
459
  const chamfer = new Chamfer();
460
460
  chamfer.firstPick.entity = core.scene.entities.get(0); // Circle — resolveEndpoints fails
@@ -465,7 +465,7 @@ test('ChamferFilletBase.validateSelection returns null when firstPick entity is
465
465
 
466
466
  test('ChamferFilletBase.validateSelection returns null when findClosestItem returns undefined', () => {
467
467
  core.scene.clear();
468
- core.scene.addItem('Line', { points: [new Point(-10, 0), new Point(0, 0)] });
468
+ core.scene.addEntity('Line', { points: [new Point(-10, 0), new Point(0, 0)] });
469
469
 
470
470
  const chamfer = new Chamfer();
471
471
  chamfer.firstPick.entity = core.scene.entities.get(0);
@@ -479,10 +479,10 @@ test('ChamferFilletBase.validateSelection returns null when findClosestItem retu
479
479
  expect(result).toBeNull();
480
480
  });
481
481
 
482
- test('ChamferFilletBase.validateSelection returns null when hovered entity is not a Line or BasePolyline', () => {
482
+ test('ChamferFilletBase.validateSelection returns null when hovered entity is not a Line or PolylineBase', () => {
483
483
  core.scene.clear();
484
- core.scene.addItem('Line', { points: [new Point(-10, 0), new Point(0, 0)] });
485
- core.scene.addItem('Circle', { points: [new Point(5, 5), new Point(10, 5)] });
484
+ core.scene.addEntity('Line', { points: [new Point(-10, 0), new Point(0, 0)] });
485
+ core.scene.addEntity('Circle', { points: [new Point(5, 5), new Point(10, 5)] });
486
486
 
487
487
  const chamfer = new Chamfer();
488
488
  chamfer.firstPick.entity = core.scene.entities.get(0);
@@ -498,8 +498,8 @@ test('ChamferFilletBase.validateSelection returns null when hovered entity is no
498
498
 
499
499
  test('ChamferFilletBase.validateSelection returns null when first and second segments are parallel', () => {
500
500
  core.scene.clear();
501
- core.scene.addItem('Line', { points: [new Point(-10, 0), new Point(0, 0)] });
502
- core.scene.addItem('Line', { points: [new Point(0, 2), new Point(10, 2)] }); // parallel horizontal
501
+ core.scene.addEntity('Line', { points: [new Point(-10, 0), new Point(0, 0)] });
502
+ core.scene.addEntity('Line', { points: [new Point(0, 2), new Point(10, 2)] }); // parallel horizontal
503
503
 
504
504
  const chamfer = new Chamfer();
505
505
  chamfer.firstPick.entity = core.scene.entities.get(0);
@@ -515,8 +515,8 @@ test('ChamferFilletBase.validateSelection returns null when first and second seg
515
515
 
516
516
  test('ChamferFilletBase.validateSelection returns selection object for valid perpendicular lines', () => {
517
517
  core.scene.clear();
518
- core.scene.addItem('Line', { points: [new Point(-10, 0), new Point(0, 0)] }); // horizontal
519
- core.scene.addItem('Line', { points: [new Point(5, -5), new Point(5, 5)] }); // vertical at x=5
518
+ core.scene.addEntity('Line', { points: [new Point(-10, 0), new Point(0, 0)] }); // horizontal
519
+ core.scene.addEntity('Line', { points: [new Point(5, -5), new Point(5, 5)] }); // vertical at x=5
520
520
 
521
521
  const chamfer = new Chamfer();
522
522
  chamfer.firstPick.entity = core.scene.entities.get(0);
@@ -6,12 +6,12 @@ const core = new Core();
6
6
 
7
7
  test('Test Copy.action', () => {
8
8
  // Add items to scene
9
- core.scene.addItem('Line', { points: [new Point(), new Point(0, 10)] });
10
- core.scene.addItem('Circle', { points: [new Point(), new Point(0, 10)] });
11
- core.scene.addItem('Polyline', { points: [new Point(), new Point(0, 10)] });
12
- core.scene.addItem('Arc', { points: [new Point(), new Point(0, 10), new Point(10, 0)] });
13
- core.scene.addItem('Rectangle', { points: [new Point(), new Point(0, 10)] });
14
- core.scene.addItem('Text', { points: [new Point(), new Point(0, 10)], height: 10, rotation: 0, string: 'text test' });
9
+ core.scene.addEntity('Line', { points: [new Point(), new Point(0, 10)] });
10
+ core.scene.addEntity('Circle', { points: [new Point(), new Point(0, 10)] });
11
+ core.scene.addEntity('Polyline', { points: [new Point(), new Point(0, 10)] });
12
+ core.scene.addEntity('Arc', { points: [new Point(), new Point(0, 10), new Point(10, 0)] });
13
+ core.scene.addEntity('Rectangle', { points: [new Point(), new Point(0, 10)] });
14
+ core.scene.addEntity('Text', { points: [new Point(), new Point(0, 10)], height: 10, rotation: 0, string: 'text test' });
15
15
 
16
16
  // Add items to selection set
17
17
  for (let i = 0; i < core.scene.entities.count(); i++) {
@@ -27,7 +27,7 @@ describe('Copybase Tool', () => {
27
27
  // Select both
28
28
  DesignCore.Scene.selectionManager.addToSelectionSet(0);
29
29
  DesignCore.Scene.selectionManager.addToSelectionSet(1);
30
- expect(DesignCore.Scene.selectionManager.selectedItems).toHaveLength(2);
30
+ expect(DesignCore.Scene.selectionManager.selectedEntities).toHaveLength(2);
31
31
 
32
32
  const tool = new Copybase();
33
33
  tool.points.push(new Point(10, 11)); // set base point
@@ -44,7 +44,7 @@ describe('Copybase Tool', () => {
44
44
  const line = DesignCore.CommandManager.createNew('Line', { layer: '0', points: [new Point(0, 0), new Point(10, 0)] });
45
45
  DesignCore.Scene.entities.add(line);
46
46
  DesignCore.Scene.selectionManager.addToSelectionSet(0);
47
- const originalClonePoints = DesignCore.Scene.selectionManager.selectedItems[0].points.map((p) => ({ x: p.x, y: p.y }));
47
+ const originalClonePoints = DesignCore.Scene.selectionManager.selectedEntities[0].points.map((p) => ({ x: p.x, y: p.y }));
48
48
 
49
49
  const tool = new Copybase();
50
50
  tool.action();
@@ -27,7 +27,7 @@ describe('Copyclip Tool', () => {
27
27
  // Select both
28
28
  DesignCore.Scene.selectionManager.addToSelectionSet(0);
29
29
  DesignCore.Scene.selectionManager.addToSelectionSet(1);
30
- expect(DesignCore.Scene.selectionManager.selectedItems).toHaveLength(2);
30
+ expect(DesignCore.Scene.selectionManager.selectedEntities).toHaveLength(2);
31
31
 
32
32
  const tool = new Copyclip();
33
33
  tool.action();
@@ -43,7 +43,7 @@ describe('Copyclip Tool', () => {
43
43
  const line = DesignCore.CommandManager.createNew('Line', { layer: '0', points: [new Point(0, 0), new Point(10, 0)] });
44
44
  DesignCore.Scene.entities.add(line);
45
45
  DesignCore.Scene.selectionManager.addToSelectionSet(0);
46
- const originalClonePoints = DesignCore.Scene.selectionManager.selectedItems[0].points.map((p) => ({ x: p.x, y: p.y }));
46
+ const originalClonePoints = DesignCore.Scene.selectionManager.selectedEntities[0].points.map((p) => ({ x: p.x, y: p.y }));
47
47
 
48
48
  const tool = new Copyclip();
49
49
  tool.action();
@@ -38,7 +38,7 @@ test('CornerEntity.direction returns lineEnd minus lineStart', () => {
38
38
 
39
39
  test('CornerEntity.resolveEndpoints returns true and sets lineStart/lineEnd for a Line', () => {
40
40
  core.scene.clear();
41
- core.scene.addItem('Line', { points: [new Point(0, 0), new Point(10, 0)] });
41
+ core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(10, 0)] });
42
42
  const line = core.scene.entities.get(0);
43
43
 
44
44
  const corner = new CornerEntity();
@@ -51,7 +51,7 @@ test('CornerEntity.resolveEndpoints returns true and sets lineStart/lineEnd for
51
51
 
52
52
  test('CornerEntity.resolveEndpoints returns false and leaves endpoints null for a non-Line', () => {
53
53
  core.scene.clear();
54
- core.scene.addItem('Circle', { points: [new Point(0, 0), new Point(5, 0)] });
54
+ core.scene.addEntity('Circle', { points: [new Point(0, 0), new Point(5, 0)] });
55
55
  const circle = core.scene.entities.get(0);
56
56
 
57
57
  const corner = new CornerEntity();
@@ -66,7 +66,7 @@ test('CornerEntity.resolveEndpoints returns false and leaves endpoints null for
66
66
 
67
67
  test('CornerEntity.setEntity returns true and clears segment for a plain Line entity', () => {
68
68
  core.scene.clear();
69
- core.scene.addItem('Line', { points: [new Point(0, 0), new Point(10, 0)] });
69
+ core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(10, 0)] });
70
70
  const line = core.scene.entities.get(0);
71
71
 
72
72
  const corner = new CornerEntity();
@@ -77,7 +77,7 @@ test('CornerEntity.setEntity returns true and clears segment for a plain Line en
77
77
 
78
78
  test('CornerEntity.setEntity sets segment and segmentIndex for a polyline straight segment', () => {
79
79
  core.scene.clear();
80
- core.scene.addItem('Lwpolyline', { points: [new Point(0, 0), new Point(10, 0), new Point(10, 10)] });
80
+ core.scene.addEntity('Lwpolyline', { points: [new Point(0, 0), new Point(10, 0), new Point(10, 10)] });
81
81
  const poly = core.scene.entities.get(0);
82
82
 
83
83
  const corner = new CornerEntity();
@@ -93,7 +93,7 @@ test('CornerEntity.setEntity notifies and returns false for a polyline arc segme
93
93
  // bulge on the start point makes the segment an arc
94
94
  const arcStart = new Point(0, 0);
95
95
  arcStart.bulge = 1;
96
- core.scene.addItem('Lwpolyline', { points: [arcStart, new Point(10, 0)] });
96
+ core.scene.addEntity('Lwpolyline', { points: [arcStart, new Point(10, 0)] });
97
97
  const poly = core.scene.entities.get(0);
98
98
 
99
99
  const errorMsg = 'arc segment error';
@@ -150,7 +150,7 @@ test('CornerEntity.keepStart returns true when segment start is on the click sid
150
150
  // Polyline: (0,0)→(10,0)→(10,10), click at (3,2), intersection=(10,0)
151
151
  // clickOnLine=(3,0), clickDir=(−7,0) → points toward start side
152
152
  core.scene.clear();
153
- core.scene.addItem('Lwpolyline', { points: [new Point(0, 0), new Point(10, 0), new Point(10, 10)] });
153
+ core.scene.addEntity('Lwpolyline', { points: [new Point(0, 0), new Point(10, 0), new Point(10, 10)] });
154
154
  const poly = core.scene.entities.get(0);
155
155
 
156
156
  const corner = new CornerEntity();
@@ -167,7 +167,7 @@ test('CornerEntity.keepStart returns false when segment end is on the click side
167
167
  // Same polyline, click at (8,2), intersection=(0,0)
168
168
  // clickOnLine=(8,0), clickDir=(8,0) → points toward end side
169
169
  core.scene.clear();
170
- core.scene.addItem('Lwpolyline', { points: [new Point(0, 0), new Point(10, 0), new Point(10, 10)] });
170
+ core.scene.addEntity('Lwpolyline', { points: [new Point(0, 0), new Point(10, 0), new Point(10, 10)] });
171
171
  const poly = core.scene.entities.get(0);
172
172
 
173
173
  const corner = new CornerEntity();
@@ -186,7 +186,7 @@ test('CornerEntity.keepStart handles closing segment of closed polyline (segment
186
186
  // lineStart=(10,10), lineEnd=(0,0), click at (9,9), intersection=(10,0)
187
187
  // clickOnLine=(10,9.something...) but we just need keepStart not to throw
188
188
  core.scene.clear();
189
- core.scene.addItem('Lwpolyline', { points: [new Point(0, 0), new Point(10, 0), new Point(10, 10)] });
189
+ core.scene.addEntity('Lwpolyline', { points: [new Point(0, 0), new Point(10, 0), new Point(10, 10)] });
190
190
  const poly = core.scene.entities.get(0);
191
191
 
192
192
  const corner = new CornerEntity();
@@ -27,7 +27,7 @@ describe('Cutclip Tool', () => {
27
27
  // Select both
28
28
  DesignCore.Scene.selectionManager.addToSelectionSet(0);
29
29
  DesignCore.Scene.selectionManager.addToSelectionSet(1);
30
- expect(DesignCore.Scene.selectionManager.selectedItems).toHaveLength(2);
30
+ expect(DesignCore.Scene.selectionManager.selectedEntities).toHaveLength(2);
31
31
 
32
32
  const tool = new Cutclip();
33
33
  tool.action();
@@ -45,7 +45,7 @@ describe('Cutclip Tool', () => {
45
45
  const line = DesignCore.CommandManager.createNew('Line', { layer: '0', points: [new Point(0, 0), new Point(10, 0)] });
46
46
  DesignCore.Scene.entities.add(line);
47
47
  DesignCore.Scene.selectionManager.addToSelectionSet(0);
48
- const originalClonePoints = DesignCore.Scene.selectionManager.selectedItems[0].points.map((p) => ({ x: p.x, y: p.y }));
48
+ const originalClonePoints = DesignCore.Scene.selectionManager.selectedEntities[0].points.map((p) => ({ x: p.x, y: p.y }));
49
49
 
50
50
  const tool = new Cutclip();
51
51
  tool.action();
@@ -6,12 +6,12 @@ const core = new Core();
6
6
 
7
7
  test('Test Erase.action', () => {
8
8
  // Add items to scene
9
- core.scene.addItem('Line', { points: [new Point(10, 0), new Point(20, 0)] });
10
- core.scene.addItem('Circle', { points: [new Point(10, 0), new Point(20, 0)] });
11
- core.scene.addItem('Polyline', { points: [new Point(10, 0), new Point(20, 0)] });
12
- core.scene.addItem('Arc', { points: [new Point(10, 0), new Point(10, 10), new Point(0, 10)] });
13
- core.scene.addItem('Rectangle', { points: [new Point(10, 0), new Point(0, 10)] });
14
- core.scene.addItem('Text', { points: [new Point(10, 0), new Point(0, 10)], height: 10, rotation: 0, string: 'text test' });
9
+ core.scene.addEntity('Line', { points: [new Point(10, 0), new Point(20, 0)] });
10
+ core.scene.addEntity('Circle', { points: [new Point(10, 0), new Point(20, 0)] });
11
+ core.scene.addEntity('Polyline', { points: [new Point(10, 0), new Point(20, 0)] });
12
+ core.scene.addEntity('Arc', { points: [new Point(10, 0), new Point(10, 10), new Point(0, 10)] });
13
+ core.scene.addEntity('Rectangle', { points: [new Point(10, 0), new Point(0, 10)] });
14
+ core.scene.addEntity('Text', { points: [new Point(10, 0), new Point(0, 10)], height: 10, rotation: 0, string: 'text test' });
15
15
 
16
16
  // Add items to selection set
17
17
  for (let i = 0; i < core.scene.entities.count(); i++) {
@@ -7,12 +7,12 @@ const core = new Core();
7
7
 
8
8
  test('Test Explode.action', () => {
9
9
  const insertPoint = new Point(100, 100);
10
- const insertIndex = core.scene.addItem('Insert', { points: [insertPoint] });
10
+ const insertIndex = core.scene.addEntity('Insert', { points: [insertPoint] });
11
11
  const insert = core.scene.entities.get(insertIndex);
12
12
 
13
13
  for (let i = 0; i < 5; i++) {
14
14
  const line = new Line({ points: [new Point(0, i * 10), new Point(100, i * 10)] });
15
- insert.block.addItem(line);
15
+ insert.block.addEntity(line);
16
16
  }
17
17
 
18
18
  expect(core.scene.entities.count()).toBe(1);