-
Notifications
You must be signed in to change notification settings - Fork 100
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 for the label clipping in the label layout algorithm #3273
base: master
Are you sure you want to change the base?
Changes from 2 commits
0bb3109
5d8092e
9150078
48ef1e4
6e96b77
ef51d6e
267bb41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,7 +158,13 @@ private void UpdateFormatting(IEnumerable<MatchRgbHexColor> colorRows) | |
public void OnLabelOverlapPropertyChange(object sender, PropertyChangedEventArgs e) | ||
{ | ||
if (e.PropertyName == @"GroupComparisonAvoidLabelOverlap") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably have been:
so that "Find References" and other sorts of refactoring would work a little bit better. |
||
{ | ||
Settings.Default.PropertyChanged -= OnLabelOverlapPropertyChange; | ||
Settings.Default.GroupComparisonSuspendLabelLayout = false; | ||
_labelsLayout = null; | ||
GraphSummary.UpdateUI(); | ||
Settings.Default.PropertyChanged += OnLabelOverlapPropertyChange; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I have to write code which removes a listener and adds it back I usually put it inside of a try/finally:
That way, even if some sort of exception happens, things still get back into an expected state. For something like this, I would probably just have a field:
But the way you have this is fine too. |
||
} | ||
else if (e.PropertyName == @"GroupComparisonSuspendLabelLayout") | ||
{ | ||
if (!Settings.Default.GroupComparisonSuspendLabelLayout) | ||
|
@@ -364,14 +370,15 @@ public override void UpdateGraph(bool selectionChanged) | |
UpdateAxes(); | ||
if (Settings.Default.GroupComparisonAvoidLabelOverlap) | ||
{ | ||
if (Settings.Default.GroupComparisonSuspendLabelLayout) | ||
{ | ||
AdjustLabelSpacings(_labeledPoints, _labelsLayout); | ||
_labelsLayout = GraphSummary.GraphControl.GraphPane.Layout?.PointsLayout; | ||
} | ||
AdjustLabelSpacings(_labeledPoints, _labelsLayout); | ||
_labelsLayout = GraphSummary.GraphControl.GraphPane.Layout?.PointsLayout; | ||
} | ||
else | ||
DotPlotUtil.AdjustLabelLocations(_labeledPoints, GraphSummary.GraphControl.GraphPane.YAxis.Scale, GraphSummary.GraphControl.GraphPane.Rect.Height); | ||
{ | ||
EnableLabelLayout = false; | ||
DotPlotUtil.AdjustLabelLocations(_labeledPoints, GraphSummary.GraphControl.GraphPane.YAxis.Scale, | ||
GraphSummary.GraphControl.GraphPane.Rect.Height); | ||
} | ||
} | ||
|
||
private void this_AxisChangeEvent(GraphPane pane) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I understand why
labelRect.Width / 2
gets added to the X-coordinate, but a similar sort of thing does not get added to the Y-coordinate.This code might be correct, but I wanted to point out that it looks suspicious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because label coordinates are top-middle, so Y coordinate is not adjusted.