@flighthq/clip 0.2.0 → 0.2.1-next.423.3350e53
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/package.json +4 -4
- package/src/clipRegion.test.ts +24 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/clip",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-next.423.3350e53",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/flighthq/flight.git",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@flighthq/geometry": "0.2.
|
|
36
|
-
"@flighthq/path": "0.2.
|
|
37
|
-
"@flighthq/types": "0.2.
|
|
35
|
+
"@flighthq/geometry": "0.2.1-next.423.3350e53",
|
|
36
|
+
"@flighthq/path": "0.2.1-next.423.3350e53",
|
|
37
|
+
"@flighthq/types": "0.2.1-next.423.3350e53"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"typescript": "^5.3.0"
|
package/src/clipRegion.test.ts
CHANGED
|
@@ -583,6 +583,30 @@ describe('unionClipRegions', () => {
|
|
|
583
583
|
expect(out.version).toBe(1);
|
|
584
584
|
});
|
|
585
585
|
|
|
586
|
+
it('is alias-safe when out === a', () => {
|
|
587
|
+
const a = createClipRegionFromRectangle(createRectangle(0, 0, 10, 10));
|
|
588
|
+
const b = createClipRegionFromRectangle(createRectangle(5, 5, 15, 15));
|
|
589
|
+
const expected = createClipRegionFromRectangle(createRectangle(0, 0, 1, 1));
|
|
590
|
+
unionClipRegions(expected, a, b);
|
|
591
|
+
unionClipRegions(a, a, b);
|
|
592
|
+
expect(a.rect.x).toBe(expected.rect.x);
|
|
593
|
+
expect(a.rect.y).toBe(expected.rect.y);
|
|
594
|
+
expect(a.rect.width).toBe(expected.rect.width);
|
|
595
|
+
expect(a.rect.height).toBe(expected.rect.height);
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
it('is alias-safe when out === b', () => {
|
|
599
|
+
const a = createClipRegionFromRectangle(createRectangle(0, 0, 10, 10));
|
|
600
|
+
const b = createClipRegionFromRectangle(createRectangle(5, 5, 15, 15));
|
|
601
|
+
const expected = createClipRegionFromRectangle(createRectangle(0, 0, 1, 1));
|
|
602
|
+
unionClipRegions(expected, a, b);
|
|
603
|
+
unionClipRegions(b, a, b);
|
|
604
|
+
expect(b.rect.x).toBe(expected.rect.x);
|
|
605
|
+
expect(b.rect.y).toBe(expected.rect.y);
|
|
606
|
+
expect(b.rect.width).toBe(expected.rect.width);
|
|
607
|
+
expect(b.rect.height).toBe(expected.rect.height);
|
|
608
|
+
});
|
|
609
|
+
|
|
586
610
|
it('preserves contours from the richer input', () => {
|
|
587
611
|
const path = createPath();
|
|
588
612
|
appendPathMoveTo(path, 0, 0);
|