@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.
- package/.github/workflows/DesignCoreQA.yml +3 -0
- package/core/designCore.js +1 -1
- package/core/dimensions/alignedDimension.js +7 -7
- package/core/dimensions/angularDimension.js +32 -32
- package/core/dimensions/{baseCircularDimension.js → circularDimensionBase.js} +19 -19
- package/core/dimensions/diametricDimension.js +10 -10
- package/core/dimensions/dimension.js +42 -42
- package/core/dimensions/{baseDimension.js → dimensionBase.js} +17 -17
- package/core/dimensions/{baseLinearDimension.js → linearDimensionBase.js} +9 -9
- package/core/dimensions/radialDimension.js +8 -8
- package/core/dimensions/rotatedDimension.js +8 -8
- package/core/entities/arc.js +22 -22
- package/core/entities/arctext.js +13 -13
- package/core/entities/circle.js +7 -7
- package/core/entities/hatch.js +210 -40
- package/core/entities/insert.js +11 -6
- package/core/entities/point.js +19 -19
- package/core/entities/polyline.js +3 -3
- package/core/entities/{basePolyline.js → polylineBase.js} +18 -18
- package/core/entities/text.js +4 -4
- package/core/lib/boundingBox.js +11 -11
- package/core/lib/canvas.js +13 -6
- package/core/lib/clipboard.js +2 -2
- package/core/lib/dxf/dxf.js +11 -11
- package/core/lib/dxf/dxfIterator.js +2 -2
- package/core/lib/entityManager.js +19 -19
- package/core/lib/inputManager.js +1 -1
- package/core/lib/matrix.js +1 -1
- package/core/lib/patterns.js +1 -1
- package/core/lib/polylineUtils.js +9 -9
- package/core/lib/renderers/cairoRenderer.js +5 -5
- package/core/lib/renderers/canvasRenderer.js +4 -4
- package/core/lib/renderers/pdfRenderer.js +7 -7
- package/core/lib/renderers/rendererBase.js +1 -1
- package/core/lib/scene.js +1 -1
- package/core/lib/selectionManager.js +18 -18
- package/core/lib/utils.js +5 -5
- package/core/properties/entityProperties.js +2 -1
- package/core/properties/flags.js +12 -0
- package/core/properties/property.js +8 -3
- package/core/properties/propertyManager.js +52 -37
- package/core/tables/block.js +50 -46
- package/core/tables/dimStyle.js +5 -5
- package/core/tables/ltypeManager.js +1 -1
- package/core/tables/vport.js +2 -2
- package/core/tools/chamfer.js +6 -6
- package/core/tools/chamferFilletBase.js +4 -4
- package/core/tools/copy.js +8 -8
- package/core/tools/copybase.js +3 -3
- package/core/tools/copyclip.js +3 -3
- package/core/tools/cornerEntity.js +2 -2
- package/core/tools/cutclip.js +3 -3
- package/core/tools/explode.js +6 -6
- package/core/tools/extend.js +13 -13
- package/core/tools/fillet.js +6 -6
- package/core/tools/matchProp.js +1 -1
- package/core/tools/mirror.js +11 -11
- package/core/tools/move.js +5 -5
- package/core/tools/offset.js +29 -29
- package/core/tools/purge.js +10 -10
- package/core/tools/rotate.js +16 -16
- package/core/tools/scale.js +6 -6
- package/core/tools/trim.js +15 -15
- package/cspell.json +323 -0
- package/package.json +1 -1
- package/test/dimensions/alignedDimension.test.js +3 -3
- package/test/dimensions/angularDimension.test.js +7 -7
- package/test/dimensions/diametricDimension.test.js +9 -9
- package/test/dimensions/dimension.test.js +12 -12
- package/test/dimensions/{baseDimension.test.js → dimensionBase.test.js} +12 -12
- package/test/dimensions/{baseLinearDimension.test.js → linearDimensionBase.test.js} +7 -7
- package/test/dimensions/radialDimension.test.js +9 -9
- package/test/dimensions/rotatedDimension.test.js +4 -4
- package/test/entities/arc.test.js +10 -10
- package/test/entities/arctext.test.js +6 -6
- package/test/entities/circle.test.js +18 -18
- package/test/entities/hatch.test.js +362 -39
- package/test/entities/insert.test.js +9 -9
- package/test/entities/point.test.js +3 -3
- package/test/entities/{basePolyline.test.js → polylineBase.test.js} +131 -62
- package/test/entities/text.test.js +19 -19
- package/test/integration/exportIntegration.test.js +3 -3
- package/test/integration/userInputIntegration.test.js +5 -5
- package/test/lib/boundingBox.test.js +3 -3
- package/test/lib/canvas.test.js +9 -9
- package/test/lib/clipboard.test.js +73 -0
- package/test/lib/inputManager.test.js +4 -4
- package/test/lib/scene.test.js +9 -9
- package/test/lib/selectionManager.test.js +3 -3
- package/test/lib/snapping.test.js +1 -1
- package/test/properties/flags.test.js +24 -0
- package/test/properties/propertyManager.test.js +93 -22
- package/test/renderers/pdfRenderer.test.js +2 -2
- package/test/tables/block.test.js +63 -14
- package/test/tables/layerManager.test.js +2 -2
- package/test/test-helpers/hatchGridRenderer.js +3 -3
- package/test/test-helpers/test-helpers.js +6 -6
- package/test/tools/chamfer.test.js +60 -60
- package/test/tools/chamferFilletBase.test.js +36 -36
- package/test/tools/copy.test.js +6 -6
- package/test/tools/copybase.test.js +2 -2
- package/test/tools/copyclip.test.js +2 -2
- package/test/tools/cornerEntity.test.js +8 -8
- package/test/tools/cutclip.test.js +2 -2
- package/test/tools/erase.test.js +6 -6
- package/test/tools/explode.test.js +2 -2
- package/test/tools/extend.test.js +84 -84
- package/test/tools/fillet.test.js +62 -62
- package/test/tools/matchProp.test.js +6 -6
- package/test/tools/mirror.test.js +26 -26
- package/test/tools/move.test.js +7 -7
- package/test/tools/offset.test.js +65 -65
- package/test/tools/purge.test.js +4 -4
- package/test/tools/rotate.test.js +10 -10
- package/test/tools/scale.test.js +28 -28
- package/test/tools/trim.test.js +109 -109
- package/test/tools/zoom.test.js +15 -17
package/test/tools/zoom.test.js
CHANGED
|
@@ -84,8 +84,8 @@ test('Test Zoom.action - Window mode with single point (should not zoom)', () =>
|
|
|
84
84
|
|
|
85
85
|
test('Test Zoom.action - All mode (calls zoomExtents)', () => {
|
|
86
86
|
// Add items to scene so extents exist
|
|
87
|
-
DesignCore.Scene.
|
|
88
|
-
DesignCore.Scene.
|
|
87
|
+
DesignCore.Scene.addEntity('Line', { points: [new Point(10, 10), new Point(100, 100)] });
|
|
88
|
+
DesignCore.Scene.addEntity('Circle', { points: [new Point(50, 50), new Point(60, 60)] });
|
|
89
89
|
|
|
90
90
|
core.canvas.width = 800;
|
|
91
91
|
core.canvas.height = 600;
|
|
@@ -181,40 +181,38 @@ test('Test Canvas.zoomToWindow - reversed points', () => {
|
|
|
181
181
|
expect(finalScale).not.toBe(initialScale);
|
|
182
182
|
});
|
|
183
183
|
|
|
184
|
-
test('Test Canvas.zoomToWindow - zero width (
|
|
184
|
+
test('Test Canvas.zoomToWindow - zero width (zooms using height)', () => {
|
|
185
185
|
core.canvas.width = 800;
|
|
186
186
|
core.canvas.height = 600;
|
|
187
187
|
core.canvas.matrix.scale(1, 1);
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
// Points with same x coordinate (zero width)
|
|
189
|
+
// Points with same x coordinate (zero width, i.e. a vertical line)
|
|
192
190
|
const pt1 = new Point(50, 0);
|
|
193
191
|
const pt2 = new Point(50, 100);
|
|
194
192
|
|
|
195
193
|
core.canvas.zoomToWindow(pt1, pt2);
|
|
196
194
|
|
|
197
|
-
//
|
|
195
|
+
// Resulting scale depends only on the window size, not the prior scale,
|
|
196
|
+
// so assert the expected value rather than comparing against initialScale
|
|
198
197
|
const finalScale = core.canvas.getScale();
|
|
199
|
-
expect(finalScale).
|
|
198
|
+
expect(finalScale).toBeCloseTo((core.canvas.height / 100) * 0.9);
|
|
200
199
|
});
|
|
201
200
|
|
|
202
|
-
test('Test Canvas.zoomToWindow - zero height (
|
|
201
|
+
test('Test Canvas.zoomToWindow - zero height (zooms using width)', () => {
|
|
203
202
|
core.canvas.width = 800;
|
|
204
203
|
core.canvas.height = 600;
|
|
205
204
|
core.canvas.matrix.scale(1, 1);
|
|
206
205
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
// Points with same y coordinate (zero height)
|
|
206
|
+
// Points with same y coordinate (zero height, i.e. a horizontal line)
|
|
210
207
|
const pt1 = new Point(0, 50);
|
|
211
208
|
const pt2 = new Point(100, 50);
|
|
212
209
|
|
|
213
210
|
core.canvas.zoomToWindow(pt1, pt2);
|
|
214
211
|
|
|
215
|
-
//
|
|
212
|
+
// Resulting scale depends only on the window size, not the prior scale,
|
|
213
|
+
// so assert the expected value rather than comparing against initialScale
|
|
216
214
|
const finalScale = core.canvas.getScale();
|
|
217
|
-
expect(finalScale).
|
|
215
|
+
expect(finalScale).toBeCloseTo((core.canvas.width / 100) * 0.9);
|
|
218
216
|
});
|
|
219
217
|
|
|
220
218
|
test('Test Canvas.zoomToWindow - same point (should not zoom)', () => {
|
|
@@ -237,7 +235,7 @@ test('Test Canvas.zoomToWindow - same point (should not zoom)', () => {
|
|
|
237
235
|
|
|
238
236
|
test('Test Zoom.action - Object mode', () => {
|
|
239
237
|
// Add an object to the scene
|
|
240
|
-
const obj = DesignCore.Scene.
|
|
238
|
+
const obj = DesignCore.Scene.addEntity('Circle', { points: [new Point(20, 20), new Point(40, 40)] });
|
|
241
239
|
|
|
242
240
|
core.canvas.width = 800;
|
|
243
241
|
core.canvas.height = 600;
|
|
@@ -281,7 +279,7 @@ test('Zoom.action - Extents mode calls zoomExtents', () => {
|
|
|
281
279
|
core.canvas.height = 600;
|
|
282
280
|
core.canvas.matrix.scale(1, 1);
|
|
283
281
|
core.scene.clear();
|
|
284
|
-
core.scene.
|
|
282
|
+
core.scene.addEntity('Line', { points: [new Point(10, 10), new Point(50, 50)] });
|
|
285
283
|
|
|
286
284
|
const initialScale = core.canvas.getScale();
|
|
287
285
|
|
|
@@ -444,7 +442,7 @@ test('Zoom.execute Extents mode: calls executeCommand without extra point prompt
|
|
|
444
442
|
|
|
445
443
|
test('Zoom.execute Object mode: with existing selection calls executeCommand without prompting', async () => {
|
|
446
444
|
core.scene.clear();
|
|
447
|
-
const idx = core.scene.
|
|
445
|
+
const idx = core.scene.addEntity('Line', { points: [new Point(0, 0), new Point(10, 10)] });
|
|
448
446
|
core.scene.selectionManager.reset();
|
|
449
447
|
core.scene.selectionManager.addToSelectionSet(idx);
|
|
450
448
|
|