tldraw/packages
Taha 73e61727cc
fix line bugs (#1936)
closes #1913 

Some lines aren't rendering:
<img width="500" alt="shapes"
src="https://github.com/tldraw/tldraw/assets/98838967/bd01bb0f-a967-46ce-9056-a81421224931">

When we begin drawing a line it's nice for the user to be able to see a
dot, so we put down two points. The end point for a new line was set to
the same position as the first point, which was causing a bunch of
divide by zero errors. Offsetting it slightly fixes that.

Now when two handles are too close together we extend the second one
instead of drawing a third. This will probably only ever happen with the
first two points of a line.

### 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. Select the Line tool and set spline to line and dash to draw
2. Click around the canvas
3. You should now be able to actually see a line
4. Now set spline to cubic and dash to solid
5. shift click around the canvas
6. You should be able to see a line!

### Release Notes

- This PR patches a couple of bugs which led to straight draw lines and
beziered dash lines not rendering on the canvas

Before & After:

<image width="250"
src="https://github.com/tldraw/tldraw/assets/98838967/e0ca7d54-506f-4014-b65a-6b61a98e3665"
/>
<image width="250"
src="https://github.com/tldraw/tldraw/assets/98838967/90c9fa12-1bcb-430d-80c7-97e1faacea16"
/>

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-09-29 15:07:14 +00:00
..
assets [feature] Add val town embed (#1777) 2023-07-31 15:44:33 +00:00
editor Allow right clicking selection backgrounds (#1968) 2023-09-29 12:31:43 +00:00
state [improvement] More selection logic (#1806) 2023-08-13 15:55:24 +00:00
store Fix shape drag perf (#1932) 2023-09-19 15:29:13 +00:00
tldraw fix line bugs (#1936) 2023-09-29 15:07:14 +00:00
tlschema Fix arrow handle snapping, snapping to text labels, selection of text labels (#1910) 2023-09-18 14:59:27 +00:00
utils move some utils into tldraw/utils (#1750) 2023-07-19 10:50:40 +00:00
validate Add shapes to exports (#1776) 2023-07-28 16:08:59 +00:00