Skip to content

Try out visibility:inherit default for text - #990

Merged
etpinard merged 2 commits into
masterfrom
visibility-inherit
Oct 12, 2016
Merged

Try out visibility:inherit default for text#990
etpinard merged 2 commits into
masterfrom
visibility-inherit

Conversation

@rreusser

@rreusserrreusser commented Sep 29, 2016

Copy link
Copy Markdown
Contributor

See #984

The goal of this PR is to get circle-ci to see what happens if the visibility default on text is visibility: inherit instead of visibility: visible. visible hard-codes it and is difficult to override. I had an ominous feeling about this change leading to a rabbit hole of related fixes and compensations, but let's see what happens…

@etpinardetpinard added this to the v1.18.0 milestone Sep 29, 2016
_context.text('')
.style({
visibility: 'visible',
visibility: 'inherit',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is definitively the first step to take. 👍

My only concern here is possible incompatibilities in Illustrator and svg conversion tools (e.g. Batik).

To avoid any rolling 🎲 , I'm thinking about adding a few lines to the toSVG routine making sure all exported images get visibility: 'visible' as opposed to inherit while interactive graphs would get 'inherit'.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Good to know about. That's the sort of obscure possibility for interaction that I thought maybe could exist.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Feel free to pull this fix wherever you need or redo it elsewhere. I won't worry further about it.

 with *visibility: inherit* on SVG export

@rreusserrreusser left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

This all looks good to me. I assume tspans never have visibility set. I'm also assuming that there aren't other corner cases or obscure features that would cause potential issues.

Comment threadsrc/snapshot/tosvg.js
var txt = d3.select(this);

// hidden text is pre-formatting mathjax,
// the browser ignores it but it can still confuse batik

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

This seems to make sense 👍

Comment threadsrc/snapshot/tosvg.js
return;
}
else {
// force other visibility value to export as visible

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

This also makes sense. Presumably it overwrites visibility: inherit (or anything that's not hidden, for that matter), with visible. Which seems correct.

textElements = svgDOM.getElementsByTagName('text');

for(var i = 0; i < textElements.length; i++) {
expect(textElements[i].style.visibility).toEqual('visible');

@rreusserrreusserOct 12, 2016

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Good check. 👍

@rreusser

Copy link
Copy Markdown
ContributorAuthor

Kinda transferred ownership of this PR. Feel free to merge if you're content, otherwise let me know if further action is required.

@etpinard
etpinard merged commit f7a8afa into masterOct 12, 2016
@etpinard
etpinard deleted the visibility-inherit branch October 12, 2016 18:31
@fresheneesz

Copy link
Copy Markdown

Thanks!

@etpinardetpinard mentioned this pull request Jun 16, 2017
2 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugsomething broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@rreusser@fresheneesz@etpinard