Skip to content

Fix legend scrollbox and border overlap #474

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

Closed

Conversation

n-riesco
Copy link
Contributor

This PR contains:

  • a cleanup of legend.draw
  • a fix for the legend scrollbox and border overlap described here

This PR is ready for review. Next I'm planning to address issue #53 .

* Moved clip-path from legend to scrollbox, to ensure the scrollbox
  doesn't overlap with the legend border.

* Some jasmine tests failed because they used the legend clip-path to
  determine the legend height. Added attribute `data-height` to legend
  to help these jasmine tests.

* The baseline image for `legend_scroll.json` needed updating because
  the scrollbox in that mock overlapped with the legend border.
scrollBox = createScrollBox(), // contains all the legend traces
scrollBar = createScrollBar(), // scroll bar (visible only if needed)
groups = createGroups(), // legend groups
traces = createLegendTraces(); // legend traces
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a fan of this pattern.

I'm more in the school of don't make a bunch of 10-line functions if you're only going to use them once.

@mdtusz this is mostly your code, what are your thoughts on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. Small functions are great, but only if they're generalised - otherwise it's just more mental overhead to jump to them (although I'm guilty of doing this in some places too).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

: | I already did something similar here. The main purpose is to document the code.

Shall I revert this change and avoid it in the future?

Copy link
Contributor

Choose a reason for hiding this comment

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

@n-riesco the difference between c53303b and the ⏫ is that the small functions in the shape code are called inside if-else. Spitting the lifecycle steps into separate functions in that case was valuable (who wants to read a 20+ line else block?).

In the above ⏫, there's no if-else clauses, just node update patterns.

Copy link
Contributor

Choose a reason for hiding this comment

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

@n-riesco

Shall I revert this change?

Yes please.

@etpinard etpinard added bug something broken status: in progress labels Apr 26, 2016
@n-riesco n-riesco closed this Apr 26, 2016
@n-riesco n-riesco deleted the fix-legend-scrollbox-and-border-overlap branch April 26, 2016 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants