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

Basic three-rect selection #30

Merged
merged 1 commit into from
Jul 8, 2018
Merged

Conversation

ocrickard
Copy link
Contributor

This is a really basic implementation of the three-rect selection system that most major browsers and OSes implement.

However, it isn't fully-featured:

  1. In most other algorithms the bottom of the firstRect will be extended downward to intersect with the bodyRect. Same with the lastRect, but upwards. This is pretty easy to implement, but I just haven't done it here.
  2. In most other algorithms the firstRect's right boundary is aligned with the right bounds of the body, and similarly for the lastRect aligned with the left boundary of the body. This is ugly to implement because the logic has to be flipped for RTL layouts.

Resolves most of #27

path.append(UIBezierPath(roundedRect: bodyRect.insetBy(dx: -2, dy: -2), cornerRadius: 3))
}
if !lastRect.isNull {
path.append(UIBezierPath(roundedRect: lastRect.insetBy(dx: -2, dy: -2), cornerRadius: 3))
Copy link
Member

Choose a reason for hiding this comment

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

Follow-up: put -2 and 3 into local vars

@rnystrom rnystrom merged commit fa2ba31 into GitHawkApp:master Jul 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants