Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix line bugs #1936

Merged
merged 6 commits into from
Sep 29, 2023
Merged

fix line bugs #1936

merged 6 commits into from
Sep 29, 2023

Conversation

Taha-Hassan-Git
Copy link
Contributor

@Taha-Hassan-Git Taha-Hassan-Git commented Sep 20, 2023

closes #1913

Some lines aren't rendering:
shapes

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

  • patch — Bug fix
  • minor — New feature
  • major — Breaking change
  • dependencies — Changes to package dependencies1
  • documentation — Changes to the documentation only2
  • tests — Changes to any test code only2
  • internal — Any other changes that don't affect the published package2
  • I don't know

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:

Footnotes

  1. publishes a patch release, for devDependencies use internal

  2. will not publish a new version 2 3

@huppy-bot huppy-bot bot added the bugfix Bug fix label Sep 20, 2023
@vercel
Copy link

vercel bot commented Sep 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
examples ✅ Ready (Inspect) Visit Preview Sep 29, 2023 0:53am

remove the initial 0.1 offset when dragging a new line, this helps pass the tests
this.editor.setCurrentTool('select.dragging_handle', {
shape: this.shape,
isCreating: true,
handle: last(handles)!,
handle: { ...lastHandle, x: lastHandle.x - 0.1, y: lastHandle.y - 0.1 },
Copy link
Contributor Author

@Taha-Hassan-Git Taha-Hassan-Git Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks weird.
The end handle is initially set to the pos 0.1, 0.1 . When shift clicking, we update the position of the end handle to a new point on the second click. But, when clicking then dragging we actually need to shave this offset off somehow (the branch was failing Line Tool tests and any snapshot tests that drew lines without this change). This was what I came up with, but there may be a better way.

@steveruizok steveruizok added this pull request to the merge queue Sep 29, 2023
Merged via the queue into main with commit 73e6172 Sep 29, 2023
5 checks passed
@steveruizok steveruizok deleted the taha/fix-buggy-lines branch September 29, 2023 15:15
pull bot pushed a commit to OneToolsCollection/tldraw-tldraw that referenced this pull request Oct 7, 2023
…n the toolbar (tldraw#1459)

Disable `g` keyboard shortcut in readonly mode. Show laser tool in
toolbar when in readonly mode.

Resolves [tldraw#1936](tldraw/brivate#1936)
Resolves [tldraw#1935](tldraw/brivate#1935)

### Change Type

- [x] `patch` — Bug Fix

### Test Plan

1. Open a readonly room.
2. Press `g` and make sure it doesn't switch to it.
3. Laser tool should be visible in the toolbar in readonly rooms.


### Release Notes

- Disable geo tool shortcut in readonly mode. Show laser on the toolbar.

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when shift-clicking to draw lines
2 participants