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

Draw guides for line handles #352

Merged
merged 8 commits into from
Oct 29, 2021
Merged

Draw guides for line handles #352

merged 8 commits into from
Oct 29, 2021

Conversation

amolenaar
Copy link
Member

@amolenaar amolenaar commented Oct 26, 2021

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes

What is the current behavior?

When moving a line end (a handle), no guides are created to help align the line end.

Issue Number: gaphor/gaphor#1006

What is the new behavior?

Handles are aligned with element. Line handles are also aligned with their own handles, so it's easier to make a line horizontal or vertical, without enabling the "orthogonal" setting.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

  • All Guide behavior has moved to mixins.
  • There's no longer need for a HandleMove mixin for segments: this is all handled by the tool.

@amolenaar amolenaar marked this pull request as draft October 26, 2021 20:09
@amolenaar amolenaar marked this pull request as ready for review October 26, 2021 21:14
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 27, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.36%.

Quality metrics Before After Change
Complexity 3.15 ⭐ 2.54 ⭐ -0.61 👍
Method Length 42.38 ⭐ 44.04 ⭐ 1.66 👎
Working memory 7.10 🙂 7.10 🙂 0.00
Quality 75.65% 76.01% 0.36% 👍
Other metrics Before After Change
Lines 743 772 29
Changed files Quality Before Quality After Quality Change
gaphas/guide.py 79.01% ⭐ 81.76% ⭐ 2.75% 👍
gaphas/matrix.py 89.83% ⭐ 89.83% ⭐ 0.00%
gaphas/segment.py 68.34% 🙂 67.42% 🙂 -0.92% 👎
tests/test_guide.py 76.15% ⭐ 75.71% ⭐ -0.44% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
gaphas/segment.py LineSegment.merge_segment 9 🙂 165 😞 10 😞 52.62% 🙂 Try splitting into smaller methods. Extract out complex expressions
gaphas/segment.py LineSegment.split_segment 6 ⭐ 202 😞 9 🙂 54.38% 🙂 Try splitting into smaller methods
gaphas/segment.py LineSegmentPainter.paint 4 ⭐ 144 😞 12 😞 55.96% 🙂 Try splitting into smaller methods. Extract out complex expressions
gaphas/matrix.py Matrix.set 5 ⭐ 78 🙂 12 😞 63.56% 🙂 Extract out complex expressions
gaphas/segment.py LineSegment.split 4 ⭐ 90 🙂 11 😞 64.52% 🙂 Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

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

This looks great!

@danyeaw danyeaw merged commit def3e73 into master Oct 29, 2021
@danyeaw danyeaw deleted the line-guides branch October 29, 2021 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants