StyledTextKit icon indicating copy to clipboard operation
StyledTextKit copied to clipboard

Improved selection rect handling

Open ocrickard opened this issue 7 years ago • 0 comments

Most text highlighting for large blocks break down into 3 parts, first line, body, and last line. This gives the selection a really nice outline, and also avoids the N^2 computation in the bezier path construction as more and more lines are selected.

Here's an example implementation that assumes the input rects were added to an array before the bezier path is computed:

https://gist.github.com/ocrickard/d07e30f9ba2c29fef7e491ab42c19d08

This can be done waaaaay more elegantly in Swift.

ocrickard avatar Jun 06 '18 22:06 ocrickard