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

Tooltip path #284

Merged
merged 7 commits into from
Oct 16, 2017
Merged

Tooltip path #284

merged 7 commits into from
Oct 16, 2017

Conversation

jordansread
Copy link

This is an add-on to #282 , but makes the tooltip box as a single instead of a (for the box) and a for the triangle tip.

This gets rid of the little bit of separation or overlap between the triangle and the box that appears in other vizzies:
image

@coveralls
Copy link

Coverage Status

Coverage remained the same at 72.925% when pulling 0b29f8c on jread-usgs:tooltip_path into 35bcf78 on USGS-VIZLAB:master.

@dblodgett-usgs
Copy link
Contributor

👍 I pulled down your branch on top of the latest here and it works great!

screen shot 2017-10-15 at 10 26 59 am

Copy link
Member

@aappling-usgs aappling-usgs left a comment

Choose a reason for hiding this comment

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

code changes look good to me, pair of stylistic suggestion/questions below. screenshot in PR comment was useful. remember to assign a reviewer.

var tooltip;
tooltip_bg= tipG.append('path').
attr("id", "tooltip-box").
attr("class", "tooltip-box");
Copy link
Member

Choose a reason for hiding this comment

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

good idea to get this on multiple lines.

the convention i've been seeing is to put the dot at the beginning of each new line (e.g. https://d3js.org/#introduction) - do you have an opinion on where the dots should go, and why?

also, it looks to me like there's nothing stopping you from continuing to declare and define each variable in a single command, which seems a little cleaner to me. Like this:

var tooltip_bg = tipG.append('path')
    .attr("id", "tooltip-box")
    .attr("class", "tooltip-box");

what do you think about doing it that way instead? are there reasons not to?

Copy link
Author

Choose a reason for hiding this comment

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

I was following Mary's style for the var varname; style ones. But the PR is a mix of both. Not sure why to do it in two lines?

Copy link
Author

Choose a reason for hiding this comment

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

I also prefer the .attr() line starts. I will clean that up.

halfLength = textLength / 2;
textBuffer = 6;
var tipYoffset = -2; // so that the tip is slightly above the mouse location
var tipTriangle = {x:6, y:10};
Copy link
Member

Choose a reason for hiding this comment

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

good idea to extract & name all these constants

@jordansread jordansread mentioned this pull request Oct 16, 2017
@coveralls
Copy link

Coverage Status

Coverage remained the same at 72.925% when pulling ba093f4 on jread-usgs:tooltip_path into 35bcf78 on USGS-VIZLAB:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 72.925% when pulling ba093f4 on jread-usgs:tooltip_path into 35bcf78 on USGS-VIZLAB:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants