tldraw/packages
Mitja Bezenšek 466a9a2088
Fix issues with clip paths for frames (#2406)
Fixes an issue with frame clipping paths. In fact, this should also
solve other issues we might have with intersect. Seems like our
`pointInPolygon` did not correctly detect that points in the corners or
on the edges of the polygon are in fact part of the polygon.

When calculating the intersection of two regular, intersecting
rectangles the`intersectPolygonPolygon` was returning a polygon with 2,
3, or sometimes even 0 points, which also could result in an error when
dragging one frame out of another frame.

It seems that for all intents and purposes the `pointInPolygon` function
should also consider corners and edges, but maybe we might want to
rename it?

Before:


https://github.com/tldraw/tldraw/assets/2523721/155d351d-8ceb-47c3-a263-024cab487d03

After:


https://github.com/tldraw/tldraw/assets/2523721/338b923a-f902-4dc4-a1b7-e954f906fb8d




Fixes https://github.com/tldraw/tldraw/issues/2387

### Change Type

- [x] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [ ] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version

### Test Plan

1. Add a step-by-step description of how to test your PR here.
2.

- [ ] Unit Tests
- [ ] End to end tests

### Release Notes

- Add a brief release note for your PR here.
2024-01-05 07:55:38 +00:00
..
assets Fix trademark links (#2380) 2023-12-26 09:22:04 +00:00
editor Fix issues with clip paths for frames (#2406) 2024-01-05 07:55:38 +00:00
state Update CHANGELOG.md [skip ci] 2023-12-20 15:27:34 +00:00
store Fix meta examples (#2379) 2024-01-03 08:26:22 +00:00
tldraw [example] Changing the default tldraw colors (#2402) 2024-01-04 10:06:01 +00:00
tlschema [tech debt] Primitives renaming party / cleanup (#2396) 2024-01-03 12:13:15 +00:00
utils Fix trademark links (#2380) 2023-12-26 09:22:04 +00:00
validate Fix trademark links (#2380) 2023-12-26 09:22:04 +00:00