Skip to content

Commit

Permalink
Merge pull request #3141 from plotly/rev-bounds3d_fetched-master
Browse files Browse the repository at this point in the history
Supporting reversed ranges in 3d scenes - upgrade of various gl-vis modules - resolves issue #1940
  • Loading branch information
archmoj authored Oct 24, 2018
2 parents 94c9d98 + 1b08a4c commit 581890c
Show file tree
Hide file tree
Showing 9 changed files with 373 additions and 35 deletions.
54 changes: 33 additions & 21 deletions package-lock.json

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

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,21 @@
"es6-promise": "^3.0.2",
"fast-isnumeric": "^1.1.1",
"font-atlas-sdf": "^1.3.3",
"gl-cone3d": "^1.1.0",
"gl-cone3d": "^1.2.0",
"gl-contour2d": "^1.1.4",
"gl-error3d": "^1.0.7",
"gl-error3d": "^1.0.8",
"gl-heatmap2d": "^1.0.4",
"gl-line3d": "^1.1.2",
"gl-line3d": "^1.1.3",
"gl-mat4": "^1.2.0",
"gl-mesh3d": "^2.0.0",
"gl-mesh3d": "^2.0.1",
"gl-plot2d": "^1.3.1",
"gl-plot3d": "^1.5.10",
"gl-pointcloud2d": "^1.0.1",
"gl-scatter3d": "^1.0.11",
"gl-scatter3d": "^1.0.12",
"gl-select-box": "^1.0.2",
"gl-spikes2d": "^1.0.1",
"gl-streamtube3d": "^1.0.0",
"gl-surface3d": "^1.3.5",
"gl-streamtube3d": "^1.1.0",
"gl-surface3d": "^1.3.6",
"gl-text": "^1.1.6",
"glslify": "^6.3.1",
"has-hover": "^1.0.1",
Expand Down
16 changes: 9 additions & 7 deletions src/plots/gl3d/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,16 +435,11 @@ proto.plot = function(sceneData, fullLayout, layout) {
}
var dataScale = [1, 1, 1];
for(j = 0; j < 3; ++j) {
if(dataBounds[0][j] > dataBounds[1][j]) {
if(dataBounds[1][j] === dataBounds[0][j]) {
dataScale[j] = 1.0;
}
else {
if(dataBounds[1][j] === dataBounds[0][j]) {
dataScale[j] = 1.0;
}
else {
dataScale[j] = 1.0 / (dataBounds[1][j] - dataBounds[0][j]);
}
dataScale[j] = 1.0 / (dataBounds[1][j] - dataBounds[0][j]);
}
}

Expand Down Expand Up @@ -560,6 +555,13 @@ proto.plot = function(sceneData, fullLayout, layout) {
sceneBounds[0][i] -= d / 32.0;
sceneBounds[1][i] += d / 32.0;
}

if(axis.autorange === 'reversed') {
// swap bounds:
var tmp = sceneBounds[0][i];
sceneBounds[0][i] = sceneBounds[1][i];
sceneBounds[1][i] = tmp;
}
} else {
var range = axis.range;
sceneBounds[0][i] = axis.r2l(range[0]);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
147 changes: 147 additions & 0 deletions test/image/mocks/gl3d_cone-newplot_reversed_ranges.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"data": [
{
"x": [
0.2
],
"y": [
0.4
],
"z": [
-0.6
],
"u": [
1
],
"v": [
1
],
"w": [
0
],
"type": "cone"
},
{
"x": [
0.4
],
"y": [
-0.6
],
"z": [
0.2
],
"u": [
1
],
"v": [
0
],
"w": [
1
],
"type": "cone"
},
{
"x": [
-0.6
],
"y": [
0.2
],
"z": [
0.4
],
"u": [
0
],
"v": [
1
],
"w": [
1
],
"type": "cone"
},
{
"x": [
-0.2
],
"y": [
-0.4
],
"z": [
0.6
],
"u": [
-1
],
"v": [
-1
],
"w": [
0
],
"type": "cone"
},
{
"x": [
-0.4
],
"y": [
0.6
],
"z": [
-0.2
],
"u": [
-1
],
"v": [
0
],
"w": [
-1
],
"type": "cone"
},
{
"x": [
0.6
],
"y": [
-0.2
],
"z": [
-0.4
],
"u": [
0
],
"v": [
-1
],
"w": [
-1
],
"type": "cone"
}
],
"layout": {
"height": 758,
"width": 1310,
"title": "Cone objects with Y-axis using autorange: 'reversed'",
"scene": {
"yaxis": {
"autorange": "reversed"
},
"camera": {
"eye": {
"x": 1,
"y": -1.5,
"z": 1.25
}
}
}
}
}
Loading

0 comments on commit 581890c

Please sign in to comment.