Small fix: zooming in on arrows in @excalidraw no longer leads to clipped arrows.
(This is how it used to look.)
Since I have the GIFs, here's a quick explanation. When it comes time to draw an element, it is first drawn onto an off-screen canvas. This canvas is then composed onto the main canvas.
How big should the off-screen canvas be? For arrows and other linear elements, the bounds are calculated based on the line. We also give the canvas a padding in order to catch any rogue pixels, such as an element's arrowheads.
When you zoom in on a line, its arrowheads are drawn larger. However, the off-screen canvas's padding didn't grow in relation to the zoom, leading to the clipping shown above.
The fix? Make the canvas padding proportional to the zoom. If 100% zoom has a 20px padding, a 200% zoom should have... 40px padding. Easy!

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Steve Ruiz

Steve Ruiz Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @steveruizok

14 Dec
Aspect ratio resizing was breaking my head. I just couldn't figure out when to respect the user's height (and scale the width) vs. when to respect the user's width (and scale the height).
Long story short, remember the selection's initial aspect ratio (width / height, shown in green) and compare it against the current aspect ratio (pink). If the current ratio is greater than the initial ratio, we're tall so scale the height; otherwise, scale the width.
Flips also took a minute to work though. Depending on which dimension is being scaled, we need to offset a opposite point by the scaled width or height. Really visual problem—my comments have drawings in them.
Read 5 tweets
29 Nov
How to cheat at complex hit-testing. 🧵
Hit testing against our axis-aligned rectangles is easy. Is the point left of the left edge? Right of the right edge, above the top, or below the bottom? If you answered yes to any of these questions then it's a miss; otherwise, it's a hit.
Our lines are more difficult. We want to score hits within a certain distance of the line so we need to turn the line into a box. If the line is straight then we test against a polygon (a potentially rotated rectangle). Trickier but not bad. Curved lines? Those are hard.
Read 10 tweets
28 Nov
Experiment with adjustable arrows. The whole point of my arrows library was to avoid this kind of thing—and let the algorithm "guess" the best arc for an arrow, based on its distance—but this is useful too. 🏹🧵
For comparison, here's the same arrangements (almost) with the guessing algorithm in action.
The library has always supported two options: "bow" defines the minimum arc and "stretch" adds more arc to short arrows. The first GIF is essentially a UI to set the bow of arrows with no stretch. The second GIF is a set of arrows that all have the same non-zero bow and stretch.
Read 8 tweets
3 Nov
pro level docs for @createwithplay featuring theme-aware embedded videos 👀
This is of course a png / mp4 hamburger, with device frames laid over the video. We can record videos from our device and slap them into a Screenshot component.
I like how responsive it is, even to device height. (There's some liberal use of CSS functions.)
Read 5 tweets
1 Nov
Added a layers list and more design functions (align, stretch, distribute). The layers list is using a virtual list (react window via @brian_d_vaughn) so it can keep up with the high number of nodes, too.
Another little feature I would love to see in more design tools: stretch to fill bounding box. The need doesn't come up too often, but it's tedious to set when it does.
(Link here: next-playground-blush.vercel.app/pixi/1000,
. Change that 1000 to however many boxes you want to try)
Read 4 tweets
13 Oct
Today I found a ten year old micro-app by @evanwallace with a great arrow-drawing algorithm. I worked through the code and adapted it for perfect-arrows. Really beautiful arrows! Playground here: 2vu07.csb.app
And here's the original source: madebyevan.com/fsm/ . In this app, you can adjust the arc of an arrow by clicking and dragging. I like that! But the goal with perfect is to calculate that automatically, too. Points can also be padded out here.
These arrows are using arc segments rather than quadratic curves, which is how I've been doing things so far. I really this might just be the better way. Intersection points are much easier with circles, though I imagine the algorithm will hold up with other shapes too.
Read 4 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!