@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
@@ -16,7 +16,7 @@ import { DimType } from '../properties/dimType.js';
16
16
  * Base Dimension Entity Class
17
17
  * @extends Entity
18
18
  */
19
- export class BaseDimension extends Entity {
19
+ export class DimensionBase extends Entity {
20
20
  /**
21
21
  * Create a Base Dimension
22
22
  * @param {Array} data
@@ -148,9 +148,9 @@ export class BaseDimension extends Entity {
148
148
 
149
149
  if (data.hasOwnProperty('71')) {
150
150
  // DXF Groupcode 71 - Attachment Point
151
- // 1 = Top left; 2 = Top center; 3 = Top right
152
- // 4 = Middle left; 5 = Middle center; 6 = Middle right
153
- // 7 = Bottom left; 8 = Bottom center; 9 = Bottom right
151
+ // 1 = Top left; 2 = Top centre; 3 = Top right
152
+ // 4 = Middle left; 5 = Middle centre; 6 = Middle right
153
+ // 7 = Bottom left; 8 = Bottom centre; 9 = Bottom right
154
154
  const err = 'Groupcode 71 not implemented';
155
155
  Logging.instance.debug(`${this.type} - ${err}`);
156
156
  }
@@ -301,7 +301,7 @@ export class BaseDimension extends Entity {
301
301
  const textHeight = this.getDimensionStyle().getValue('DIMTXT');
302
302
  // set the text height
303
303
  text.setProperty(Property.Names.HEIGHT, textHeight);
304
- // Always set text horizontal alignment to center
304
+ // Always set text horizontal alignment to centre
305
305
  text.setProperty(Property.Names.HORIZONTALALIGNMENT, 1);
306
306
  // Always set text vertical alignment to middle
307
307
  text.setProperty(Property.Names.VERTICALALIGNMENT, 2);
@@ -391,19 +391,19 @@ export class BaseDimension extends Entity {
391
391
 
392
392
  /**
393
393
  * Get the geometry for the centre mark
394
- * @param {Point} point centre point for center mark
395
- * @return {Array} array of entities representing the center mark
394
+ * @param {Point} point centre point for centre mark
395
+ * @return {Array} array of entities representing the centre mark
396
396
  */
397
397
  getCentreMark(point) {
398
398
  /*
399
399
  * DIMCEN value defines the centre mark type and size
400
- * 0 = No center marks or lines are drawn
401
- * <0 = Centerlines are drawn
402
- * >0 = Center marks are drawn
400
+ * 0 = No centre marks or lines are drawn
401
+ * <0 = Centrelines are drawn
402
+ * >0 = Centre marks are drawn
403
403
  */
404
404
 
405
405
  const centreMark = [];
406
- // get the center mark style
406
+ // get the centre mark style
407
407
  const markStyle = this.getDimensionStyle().getValue('DIMCENSTYL');
408
408
  // get the centre mark size
409
409
  const markSize = this.getDimensionStyle().getValue('DIMCENVALUE');
@@ -433,14 +433,14 @@ export class BaseDimension extends Entity {
433
433
  /**
434
434
  * Draw the entity
435
435
  * @param {Object} renderer
436
- * @return {Array} block items for the canvas to render recursively
436
+ * @return {Array} block entities for the canvas to render recursively
437
437
  */
438
438
  draw(renderer) {
439
- if (this.block.items.length === 0) {
439
+ if (this.block.entities.length === 0) {
440
440
  this.refresh();
441
441
  }
442
442
 
443
- return this.block.items;
443
+ return this.block.entities;
444
444
  }
445
445
 
446
446
  /**
@@ -490,18 +490,18 @@ export class BaseDimension extends Entity {
490
490
  }
491
491
 
492
492
  /**
493
- * Refesh the dimension geometry
493
+ * Refresh the dimension geometry
494
494
  */
495
495
  refresh() {
496
496
  const entities = this.buildDimension();
497
497
 
498
498
  if (entities) {
499
- this.block.clearItems();
499
+ this.block.clearEntities();
500
500
 
501
501
  entities.forEach((element) => {
502
502
  // For colour BYBLOCK for dimensions
503
503
  element.setProperty(Property.Names.COLOUR, 'BYBLOCK');
504
- this.block.addItem(element);
504
+ this.block.addEntity(element);
505
505
  });
506
506
  }
507
507
  }
@@ -3,7 +3,7 @@ import { Line } from '../entities/line.js';
3
3
  import { Text } from '../entities/text.js';
4
4
  import { Input, PromptOptions } from '../lib/inputManager.js';
5
5
  import { Logging } from '../lib/logging.js';
6
- import { BaseDimension } from './baseDimension.js';
6
+ import { DimensionBase } from './dimensionBase.js';
7
7
  import { Point } from '../entities/point.js';
8
8
 
9
9
  import { DesignCore } from '../designCore.js';
@@ -13,9 +13,9 @@ import { RubberBand } from '../lib/auxiliary/rubberBand.js';
13
13
 
14
14
  /**
15
15
  * Aligned Dimension Entity Class
16
- * @extends BaseDimension
16
+ * @extends DimensionBase
17
17
  */
18
- export class BaseLinearDimension extends BaseDimension {
18
+ export class LinearDimensionBase extends DimensionBase {
19
19
  /**
20
20
  * Create an Aligned Dimension
21
21
  * @param {Array} data
@@ -62,7 +62,7 @@ export class BaseLinearDimension extends BaseDimension {
62
62
  * Preview the entity during creation
63
63
  */
64
64
  preview() {
65
- if (this.points.length == 1) {
65
+ if (this.points.length === 1) {
66
66
  const mousePoint = DesignCore.Mouse.pointOnScene();
67
67
  DesignCore.Scene.auxiliaryEntities.add(new RubberBand([this.points.at(0), mousePoint]));
68
68
  }
@@ -190,7 +190,7 @@ export class BaseLinearDimension extends BaseDimension {
190
190
  const outsideOffsetDirection = Pt11.distance(Pt13e) < Pt11.distance(Pt14e) ? reverseDimLineAngle : dimLineAngle;
191
191
 
192
192
  switch (DIMJUST) {
193
- case 0: // 0 = Center-justified between extension lines
193
+ case 0: // 0 = Centre-justified between extension lines
194
194
  if (textOutSide) {
195
195
  textPosition = midPoint.project(outsideOffsetDirection, outsideOffsetDistance);
196
196
  }
@@ -237,7 +237,7 @@ export class BaseLinearDimension extends BaseDimension {
237
237
 
238
238
  // DIMTAD - Text vertical position
239
239
  switch (DIMTAD) {
240
- case 0: // 0 = Centers the dimension text between the extension lines.
240
+ case 0: // 0 = Centres the dimension text between the extension lines.
241
241
  break;
242
242
  case 1: // 1 = Places the dimension text above the dimension line except when the dimension line is not horizontal and text inside the extension lines is forced horizontal ( DIMTIH = 1).
243
243
  textPosition = textPosition.project(textAboveDirection, textAboveDistance);
@@ -301,8 +301,8 @@ export class BaseLinearDimension extends BaseDimension {
301
301
  dimLineTwoEnd = Pt14e;
302
302
  }
303
303
  // get the distance to extend the dimension line
304
- // when text is vertically centered trim the dimension line back from the text position
305
- // when text is not vertically centered extend the dimension line beyond the text position by half the text width
304
+ // when text is vertically centred trim the dimension line back from the text position
305
+ // when text is not vertically centred extend the dimension line beyond the text position by half the text width
306
306
  const dimlineExtendDistance = textDimlineIntersection.isSame(textPosition) ? approxTextHalfWidth + DIMGAP : -approxTextHalfWidth;
307
307
 
308
308
  if (Pt11.distance(Pt13e) < Pt11.distance(Pt14e)) {
@@ -314,7 +314,7 @@ export class BaseLinearDimension extends BaseDimension {
314
314
  }
315
315
  }
316
316
 
317
- // split the dimension line when the text is centered vertically
317
+ // split the dimension line when the text is centred vertically
318
318
  if (textIsOnInternalDimLine) {
319
319
  dimLineOneEnd = dimLineOneEnd.project(reverseDimLineAngle, approxTextWidth * 0.6);
320
320
  dimLineTwoEnd = dimLineTwoEnd.project(dimLineAngle, approxTextWidth * 0.6);
@@ -1,13 +1,13 @@
1
1
 
2
2
  import { DXFFile } from '../lib/dxf/dxfFile.js';
3
- import { BaseCircularDimension } from './baseCircularDimension.js';
3
+ import { CircularDimensionBase } from './circularDimensionBase.js';
4
4
  import { Property } from '../properties/property.js';
5
5
 
6
6
  /**
7
7
  * Radial Dimension Entity Class
8
- * @extends BaseCircularDimension
8
+ * @extends CircularDimensionBase
9
9
  */
10
- export class RadialDimension extends BaseCircularDimension {
10
+ export class RadialDimension extends CircularDimensionBase {
11
11
  /**
12
12
  * Create a Radial Dimension
13
13
  * @param {Array} data
@@ -31,17 +31,17 @@ export class RadialDimension extends BaseCircularDimension {
31
31
 
32
32
  /**
33
33
  * Get sequenced points from user selection
34
- * @param {any} items
34
+ * @param {any} entities
35
35
  * @param {Point} textPos
36
36
  * @return {Array} array of points
37
37
  */
38
- static getPointsFromSelection(items, textPos) {
39
- const item = items[0];
38
+ static getPointsFromSelection(entities, textPos) {
39
+ const entity = entities[0];
40
40
  const Pt11 = textPos;
41
41
  Pt11.sequence = 11;
42
- const Pt10 = item.points[0]; // Centre
42
+ const Pt10 = entity.points[0]; // Centre
43
43
  Pt10.sequence = 10;
44
- const Pt15 = Pt10.project(Pt10.angle(Pt11), item.getRadius());// Radius
44
+ const Pt15 = Pt10.project(Pt10.angle(Pt11), entity.getRadius());// Radius
45
45
  Pt15.sequence = 15;
46
46
 
47
47
  const points = [Pt10, Pt15, Pt11];
@@ -4,7 +4,7 @@ import { Input, PromptOptions } from '../lib/inputManager.js';
4
4
  import { Logging } from '../lib/logging.js';
5
5
  import { DXFFile } from '../lib/dxf/dxfFile.js';
6
6
  import { Point } from '../entities/point.js';
7
- import { BaseLinearDimension } from './baseLinearDimension.js';
7
+ import { LinearDimensionBase } from './linearDimensionBase.js';
8
8
 
9
9
  import { DesignCore } from '../designCore.js';
10
10
  import { Property } from '../properties/property.js';
@@ -13,9 +13,9 @@ import { RubberBand } from '../lib/auxiliary/rubberBand.js';
13
13
 
14
14
  /**
15
15
  * Rotated Dimension Entity Class
16
- * @extends BaseLinearDimension
16
+ * @extends LinearDimensionBase
17
17
  */
18
- export class RotatedDimension extends BaseLinearDimension {
18
+ export class RotatedDimension extends LinearDimensionBase {
19
19
  /**
20
20
  * Create an Rotated Dimension
21
21
  * @param {Array} data
@@ -77,20 +77,20 @@ export class RotatedDimension extends BaseLinearDimension {
77
77
 
78
78
  /**
79
79
  * Get sequenced points from user selection
80
- * @param {any} items
80
+ * @param {any} entities
81
81
  * @param {Point} textPos
82
82
  * @param {number} angle - rotation angle in degrees (default 0 = horizontal)
83
83
  * @return {Array} array of points
84
84
  */
85
- static getPointsFromSelection(items, textPos, angle = 0) {
85
+ static getPointsFromSelection(entities, textPos, angle = 0) {
86
86
  const points = [];
87
- const item = items[0];
87
+ const entity = entities[0];
88
88
 
89
- const Pt13 = item.points[0];
89
+ const Pt13 = entity.points[0];
90
90
  Pt13.sequence = 13;
91
91
  points.push(Pt13);
92
92
 
93
- const Pt14 = item.points[1];
93
+ const Pt14 = entity.points[1];
94
94
  Pt14.sequence = 14;
95
95
  points.push(Pt14);
96
96
 
@@ -27,7 +27,7 @@ export class Arc extends Entity {
27
27
  constructor(data) {
28
28
  super(data);
29
29
 
30
- // If only the center point is present, project start/end from named scalar properties.
30
+ // If only the centre point is present, project start/end from named scalar properties.
31
31
  // Full-points data (post-execute or post-fromDxf) skips this block entirely.
32
32
  if (data && this.points.length < 2) {
33
33
  const radius = data.radius ?? 1;
@@ -73,8 +73,8 @@ export class Arc extends Entity {
73
73
  * @return {Object}
74
74
  */
75
75
  static fromDxf(data) {
76
- const center = data.points?.[0];
77
- if (!center) return data;
76
+ const centre = data.points?.[0];
77
+ if (!centre) return data;
78
78
  // validate required group codes for points-based arc representation are present
79
79
  if (data[40] === undefined || data[50] === undefined || data[51] === undefined) return data;
80
80
 
@@ -82,9 +82,9 @@ export class Arc extends Entity {
82
82
  return {
83
83
  ...data,
84
84
  points: [
85
- center,
86
- center.project(Utils.degrees2radians(data[50] ?? 0), radius),
87
- center.project(Utils.degrees2radians(data[51] ?? 0), radius),
85
+ centre,
86
+ centre.project(Utils.degrees2radians(data[50] ?? 0), radius),
87
+ centre.project(Utils.degrees2radians(data[51] ?? 0), radius),
88
88
  ],
89
89
  direction: data[73] ?? 1,
90
90
  };
@@ -116,16 +116,16 @@ export class Arc extends Entity {
116
116
 
117
117
  let pt2;
118
118
  while (true) {
119
- DesignCore.Scene.inputManager.inputPoint = pt; // polar/ortho tracks from center on each attempt
119
+ DesignCore.Scene.inputManager.inputPoint = pt; // polar/ortho tracks from centre on each attempt
120
120
  const op2 = new PromptOptions(`${Strings.Input.END} ${Strings.Strings.OR} ${Strings.Input.ANGLE}`, [Input.Type.POINT, Input.Type.NUMBER]);
121
121
  pt2 = await DesignCore.Scene.inputManager.requestInput(op2);
122
122
  if (pt2 === undefined) return;
123
123
 
124
124
  if (Input.getType(pt2) === Input.Type.POINT) {
125
- // Must not be same as center or start
126
- const center = this.points[0];
125
+ // Must not be same as centre or start
126
+ const centre = this.points[0];
127
127
  const start = this.points[1];
128
- if (pt2.isSame?.(center) || pt2.isSame?.(start)) {
128
+ if (pt2.isSame?.(centre) || pt2.isSame?.(start)) {
129
129
  DesignCore.Core.notify(`${this.type} - ${Strings.Error.INVALIDPOINT}`);
130
130
  continue;
131
131
  }
@@ -193,8 +193,8 @@ export class Arc extends Entity {
193
193
  if (this.points.length >= 2) {
194
194
  const mousePoint = DesignCore.Mouse.pointOnScene();
195
195
  // const points = [...this.points, mousePoint];
196
- const center = this.points[0];
197
- const endPoint = center.project(center.angle(mousePoint), this.getProperty(Property.Names.RADIUS));
196
+ const centre = this.points[0];
197
+ const endPoint = centre.project(centre.angle(mousePoint), this.getProperty(Property.Names.RADIUS));
198
198
  if (endPoint.isSame(this.points[1])) return;
199
199
  const points = [...this.points, endPoint];
200
200
 
@@ -210,22 +210,22 @@ export class Arc extends Entity {
210
210
 
211
211
  /**
212
212
  * Infer arc direction from three points using cross product
213
- * @param {Point} center
213
+ * @param {Point} centre
214
214
  * @param {Point} start
215
215
  * @param {Point} end
216
216
  * @return {number} 1 for ccw, -1 for cw
217
217
  */
218
- static #inferDirection(center, start, end) {
218
+ static #inferDirection(centre, start, end) {
219
219
  // All points must be defined and distinct
220
- if (!center || !start || !end) {
220
+ if (!centre || !start || !end) {
221
221
  return 1; // Default to counterclockwise
222
222
  }
223
- if (center.isSame?.(start) || center.isSame?.(end) || start.isSame?.(end)) {
223
+ if (centre.isSame?.(start) || centre.isSame?.(end) || start.isSame?.(end)) {
224
224
  return 1;
225
225
  }
226
226
 
227
- const v1 = start.subtract(center);
228
- const v2 = end.subtract(center);
227
+ const v1 = start.subtract(centre);
228
+ const v2 = end.subtract(centre);
229
229
  const cross = v1.cross(v2);
230
230
  const direction = cross > 0 ? 1 : -1;
231
231
  return direction;
@@ -346,8 +346,8 @@ export class Arc extends Entity {
346
346
  * @return {Arc}
347
347
  */
348
348
  fromPolylinePoints(points) {
349
- const center = points[0].bulgeCentrePoint(points[1]);
350
- this.points = [center, new Point(points[0].x, points[0].y), new Point(points.at(-1).x, points.at(-1).y)];
349
+ const centre = points[0].bulgeCentrePoint(points[1]);
350
+ this.points = [centre, new Point(points[0].x, points[0].y), new Point(points.at(-1).x, points.at(-1).y)];
351
351
  return this;
352
352
  }
353
353
 
@@ -415,9 +415,9 @@ export class Arc extends Entity {
415
415
  closestPoint(P) {
416
416
  const startPoint = this.points[1];
417
417
  const endPoint = this.points[2];
418
- const centerPoint = this.points[0];
418
+ const centrePoint = this.points[0];
419
419
 
420
- const pnt = P.closestPointOnArc(startPoint, endPoint, centerPoint, this.getProperty(Property.Names.DIRECTION));
420
+ const pnt = P.closestPointOnArc(startPoint, endPoint, centrePoint, this.getProperty(Property.Names.DIRECTION));
421
421
 
422
422
  if (pnt !== null) {
423
423
  const distance = P.distance(pnt);
@@ -25,7 +25,7 @@ export class ArcAlignedCharacter {
25
25
 
26
26
  /**
27
27
  * @param {string} character - text character
28
- * @param {Point} position - center mid point of character
28
+ * @param {Point} position - centre mid point of character
29
29
  * @param {number} angle - in radians
30
30
  * @param {number} height - character height
31
31
  * @param {number} width - character width
@@ -192,10 +192,10 @@ export class ArcAlignedText extends Entity {
192
192
  dxfCode: 46,
193
193
  });
194
194
 
195
- // ensure points array has at least one point - the arc center
195
+ // ensure points array has at least one point - the arc centre
196
196
  if (!this.points.length) {
197
197
  this.points = [];
198
- this.points.push(new Point(0, 0)); // center point
198
+ this.points.push(new Point(0, 0)); // centre point
199
199
  }
200
200
 
201
201
  // DXF Groupcode 50 - Start Angle in degrees
@@ -225,7 +225,7 @@ export class ArcAlignedText extends Entity {
225
225
  dxfCode: 71,
226
226
  options: () => [{ display: 'Outward', value: 1 }, { display: 'Inward', value: 2 }],
227
227
  });
228
- // DXF Groupcode 72 - 1 = fit to arc, 2 = left align, 3 = right align, 4 = center
228
+ // DXF Groupcode 72 - 1 = fit to arc, 2 = left align, 3 = right align, 4 = centre
229
229
  this.properties.add(Property.Names.TEXTALIGNMENT, {
230
230
  type: Property.Type.LIST,
231
231
  value: Property.loadValue([data?.textAlignment, data?.[72]], 4),
@@ -302,7 +302,7 @@ export class ArcAlignedText extends Entity {
302
302
 
303
303
  const selection = await DesignCore.Scene.inputManager.requestInput(op);
304
304
  if (selection === undefined) return;
305
- selectedArc = DesignCore.Scene.entities.get(selection.selectedItemIndex);
305
+ selectedArc = DesignCore.Scene.entities.get(selection.selectedEntityIndex);
306
306
 
307
307
  if (selectedArc instanceof Arc === false) {
308
308
  const msg = `${this.type} - ${Strings.Error.INVALIDTYPE}: ${selectedArc.type}`;
@@ -464,7 +464,7 @@ export class ArcAlignedText extends Entity {
464
464
 
465
465
  let string = str.slice(); // make a copy of the string
466
466
 
467
- // 1 = fit to arc, 2 = left align, 3 = right align, 4 = center
467
+ // 1 = fit to arc, 2 = left align, 3 = right align, 4 = centre
468
468
  if (textAlignment === 3) { // right align
469
469
  // start at the arc start position and create the text cw around the arc
470
470
  stringStartPoint = this.points[0].project(this.startAngle() + startOffsetAngle, radialDistance);
@@ -492,8 +492,8 @@ export class ArcAlignedText extends Entity {
492
492
  // build per-character widths for the final (possibly reversed) string
493
493
  const charWidths = [...string].map((ch) => Text.getApproximateWidth(ch, height));
494
494
 
495
- // build cumulative arc angle offsets from the string start position to each character center
496
- // step between adjacent centers is the average of their two half-widths plus spacing
495
+ // build cumulative arc angle offsets from the string start position to each character centre
496
+ // step between adjacent centres is the average of their two half-widths plus spacing
497
497
  const charOffsetAngles = [0];
498
498
  if (textAlignment === 1) { // fit to arc
499
499
  if (string.length === 1) {
@@ -512,7 +512,7 @@ export class ArcAlignedText extends Entity {
512
512
  charOffsetAngles.push(charOffsetAngles[i] + this.linearToAngular(step * 0.5, radialDistance));
513
513
  }
514
514
 
515
- if (textAlignment === 4) { // center
515
+ if (textAlignment === 4) { // centre
516
516
  const arcMidPoint = this.points[0].project(this.arcMidAngle(this.startAngle(), this.endAngle()), radialDistance);
517
517
  stringStartPoint = arcMidPoint.rotate(this.points[0], charOffsetAngles.at(-1) * 0.5);
518
518
  }
@@ -568,9 +568,9 @@ export class ArcAlignedText extends Entity {
568
568
  file.writeGroupCode('2', style?.font);
569
569
  file.writeGroupCode('3', '');
570
570
  file.writeGroupCode('7', this.getProperty(Property.Names.STYLENAME)); // Test style name
571
- file.writeGroupCode('10', this.points[0].x); // x of arc center
572
- file.writeGroupCode('20', this.points[0].y); // y of arc center
573
- file.writeGroupCode('30', '0.0'); // z of arc center
571
+ file.writeGroupCode('10', this.points[0].x); // x of arc centre
572
+ file.writeGroupCode('20', this.points[0].y); // y of arc centre
573
+ file.writeGroupCode('30', '0.0'); // z of arc centre
574
574
  file.writeGroupCode('40', this.getProperty(Property.Names.RADIUS));
575
575
  file.writeGroupCode('41', this.getProperty(Property.Names.WIDTHFACTOR));
576
576
  file.writeGroupCode('42', this.getProperty(Property.Names.HEIGHT));
@@ -607,7 +607,7 @@ export class ArcAlignedText extends Entity {
607
607
  snaps(mousePoint, delta) {
608
608
  const snaps = [];
609
609
 
610
- snaps.push(new SnapPoint(this.points[0], SnapPoint.Type.CENTRE)); // arc center
610
+ snaps.push(new SnapPoint(this.points[0], SnapPoint.Type.CENTRE)); // arc centre
611
611
 
612
612
  const ArcAlignedCharacters = this.getArcAlignedCharacters();
613
613
  for (const arcAlignedChar of ArcAlignedCharacters) {
@@ -35,7 +35,7 @@ export class Circle extends Entity {
35
35
  dxfCode: 40,
36
36
  });
37
37
 
38
- // Named scalar radius (internal API / named prop) — projects points[1] from center.
38
+ // Named scalar radius (internal API / named prop) — projects points[1] from centre.
39
39
  // Full-points data (post-execute or post-fromDxf) skips this.
40
40
  if (data?.radius !== undefined && this.points.length < 2) {
41
41
  this.setRadius(data.radius);
@@ -61,11 +61,11 @@ export class Circle extends Entity {
61
61
  * @return {Object}
62
62
  */
63
63
  static fromDxf(data) {
64
- const center = data.points?.[0];
65
- if (!center || data[40] === undefined) return data;
64
+ const centre = data.points?.[0];
65
+ if (!centre || data[40] === undefined) return data;
66
66
  return {
67
67
  ...data,
68
- points: [center, center.project(0, data[40])],
68
+ points: [centre, centre.project(0, data[40])],
69
69
  };
70
70
  }
71
71
 
@@ -205,9 +205,9 @@ export class Circle extends Entity {
205
205
  */
206
206
  fromPolylinePoints(points) {
207
207
  if (points.length >= 3 && points[0].isSame(points.at(-1))) {
208
- const center = points[0].bulgeCentrePoint(points[1]);
209
- const radius = center.distance(points[0]);
210
- this.points = [center, center.project(0, radius)];
208
+ const centre = points[0].bulgeCentrePoint(points[1]);
209
+ const radius = centre.distance(points[0]);
210
+ this.points = [centre, centre.project(0, radius)];
211
211
  return this;
212
212
  }
213
213
  const arc = DesignCore.CommandManager.createNew('Arc', this);