Skip to content

Remove the performance overhead of showLink property #1557

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

Merged
merged 6 commits into from
Apr 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ plots.previousPromises = function(gd) {
* Add source links to your graph inside the 'showSources' config argument.
*/
plots.addLinks = function(gd) {
// Do not do anything if showLink and showSources are not set to true in config
if(!gd._context.showLink && !gd._context.showSources) return;

var fullLayout = gd._fullLayout;

var linkContainer = fullLayout._paper
Expand Down
6 changes: 1 addition & 5 deletions test/jasmine/tests/config_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,7 @@ describe('config argument', function() {

var link = document.getElementsByClassName('js-plot-link-container')[0];

expect(link.textContent).toBe('');

var bBox = link.getBoundingClientRect();
expect(bBox.width).toBe(0);
expect(bBox.height).toBe(0);
expect(link).toBeUndefined();
});

it('should display a link when true', function() {
Expand Down