Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"es6-promise": "^3.0.2",
"fast-isnumeric": "^1.1.1",
"font-atlas-sdf": "^1.3.3",
"gl-cone3d": "^v1.0.0",
"gl-cone3d": "^v1.0.1",
"gl-contour2d": "^1.1.4",
"gl-error3d": "^1.0.7",
"gl-heatmap2d": "^1.0.4",
Expand Down
2 changes: 1 addition & 1 deletion src/traces/cone/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fromMesh3d.forEach(function(k) {
attrs.hoverinfo = extendFlat({}, baseAttrs.hoverinfo, {
editType: 'calc',
flags: ['x', 'y', 'z', 'u', 'v', 'w', 'norm', 'text', 'name'],
dflt: 'x+y+z+norm+text'
dflt: 'x+y+z+norm+text+name'
});

module.exports = attrs;
7 changes: 1 addition & 6 deletions src/traces/cone/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,15 @@ module.exports = function calc(gd, trace) {
var len = Math.min(u.length, v.length, w.length);
var normMax = -Infinity;
var normMin = Infinity;
var compMax = -Infinity;

for(var i = 0; i < len; i++) {
var uu = u[i];
var u2 = uu * uu;
var vv = v[i];
var v2 = vv * vv;
var ww = w[i];
var w2 = ww * ww;
var norm = Math.sqrt(u2 + v2 + w2);
var norm = Math.sqrt(uu * uu + vv * vv + ww * ww);

normMax = Math.max(normMax, norm);
normMin = Math.min(normMin, norm);
compMax = Math.max(compMax, u2, v2, w2);
}

trace._normMax = normMax;
Expand Down
Binary file added test/image/baselines/gl3d_cone-single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions test/image/mocks/gl3d_cone-single.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"data": [
{
"type": "cone",
"name": "blue cone",
"x": [1], "y": [1], "z": [1],
"u": [1], "v": [1], "w": [0],
"colorscale": "Blues",
"showscale": false
},
{
"type": "cone",
"name": "green cone",
"x": [3], "y": [3], "z": [3],
"u": [0], "v": [0], "w": [2],
"colorscale": "Greens",
"showscale": false
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to play devil's advocate re: autoscale - perhaps the single-cone mock should really be just one single cone, so the data has zero range without considering the cone itself? And multi-trace could be incorporated into another mock?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah good call -> 7da71ae

],
"layout": {
"scene": {
"camera": {
"eye": {"x": -0.76, "y": 1.8, "z": 0.92}
}
}
}
}
24 changes: 24 additions & 0 deletions test/jasmine/tests/cone_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,28 @@ describe('@gl Test cone interactions', function() {
.catch(failTest)
.then(done);
});

it('should display hover labels (multi-trace case)', function(done) {
var fig = Lib.extendDeep({}, require('@mocks/gl3d_cone-single.json'));
fig.layout.margin = {l: 0, t: 0, r: 0, b: 0};
fig.layout.width = 400;
fig.layout.height = 400;

function _hover() {
mouseEvent('mouseover', 245, 230);
return delay(20)();
}

Plotly.plot(gd, fig)
.then(delay(20))
.then(_hover)
.then(function() {
assertHoverLabelContent({
nums: ['x: 1', 'y: 1', 'z: 1', 'norm: 1.41'].join('\n'),
name: 'blue cone'
});
})
.catch(failTest)
.then(done);
});
});