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

ArrayOk hoverinfo fixups #2055

Merged
merged 13 commits into from
Oct 5, 2017
Merged
3 changes: 3 additions & 0 deletions src/components/drawing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,9 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) {
var transforms;
var el = d3.select(this);
var text = el.select('text');

if(!text.node()) return;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Caught another bug. dragmode: 'pan' is broken on http://rickyreusser.com/plotly-mock-viewer/#text_chart_arrays

This fixes it:

peek 2017-10-04 18-24

Copy link
Collaborator

Choose a reason for hiding this comment

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

ha, good catch! 🎉


var x = parseFloat(text.attr('x') || 0);
var y = parseFloat(text.attr('y') || 0);

Expand Down
5 changes: 5 additions & 0 deletions test/jasmine/tests/drawing_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@ describe('Drawing', function() {
Drawing.setTextPointsScale(g, 4, 5);
expect(g.attr('transform')).toEqual('translate(8,9) scale(4,5) translate(-8,-9) translate(1, 2)');
});

it('should not break when <text> is not present', function() {
text.remove();
expect(function() { Drawing.setTextPointsScale(g, 4, 5); }).not.toThrow();
});
});

describe('bBox', function() {
Expand Down