Skip to content

Commit 581890c

Browse files
authored
Merge pull request #3141 from plotly/rev-bounds3d_fetched-master
Supporting reversed ranges in 3d scenes - upgrade of various gl-vis modules - resolves issue #1940
2 parents 94c9d98 + 1b08a4c commit 581890c

9 files changed

+373
-35
lines changed

Diff for: package-lock.json

+33-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,21 @@
7070
"es6-promise": "^3.0.2",
7171
"fast-isnumeric": "^1.1.1",
7272
"font-atlas-sdf": "^1.3.3",
73-
"gl-cone3d": "^1.1.0",
73+
"gl-cone3d": "^1.2.0",
7474
"gl-contour2d": "^1.1.4",
75-
"gl-error3d": "^1.0.7",
75+
"gl-error3d": "^1.0.8",
7676
"gl-heatmap2d": "^1.0.4",
77-
"gl-line3d": "^1.1.2",
77+
"gl-line3d": "^1.1.3",
7878
"gl-mat4": "^1.2.0",
79-
"gl-mesh3d": "^2.0.0",
79+
"gl-mesh3d": "^2.0.1",
8080
"gl-plot2d": "^1.3.1",
8181
"gl-plot3d": "^1.5.10",
8282
"gl-pointcloud2d": "^1.0.1",
83-
"gl-scatter3d": "^1.0.11",
83+
"gl-scatter3d": "^1.0.12",
8484
"gl-select-box": "^1.0.2",
8585
"gl-spikes2d": "^1.0.1",
86-
"gl-streamtube3d": "^1.0.0",
87-
"gl-surface3d": "^1.3.5",
86+
"gl-streamtube3d": "^1.1.0",
87+
"gl-surface3d": "^1.3.6",
8888
"gl-text": "^1.1.6",
8989
"glslify": "^6.3.1",
9090
"has-hover": "^1.0.1",

Diff for: src/plots/gl3d/scene.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -435,16 +435,11 @@ proto.plot = function(sceneData, fullLayout, layout) {
435435
}
436436
var dataScale = [1, 1, 1];
437437
for(j = 0; j < 3; ++j) {
438-
if(dataBounds[0][j] > dataBounds[1][j]) {
438+
if(dataBounds[1][j] === dataBounds[0][j]) {
439439
dataScale[j] = 1.0;
440440
}
441441
else {
442-
if(dataBounds[1][j] === dataBounds[0][j]) {
443-
dataScale[j] = 1.0;
444-
}
445-
else {
446-
dataScale[j] = 1.0 / (dataBounds[1][j] - dataBounds[0][j]);
447-
}
442+
dataScale[j] = 1.0 / (dataBounds[1][j] - dataBounds[0][j]);
448443
}
449444
}
450445

@@ -560,6 +555,13 @@ proto.plot = function(sceneData, fullLayout, layout) {
560555
sceneBounds[0][i] -= d / 32.0;
561556
sceneBounds[1][i] += d / 32.0;
562557
}
558+
559+
if(axis.autorange === 'reversed') {
560+
// swap bounds:
561+
var tmp = sceneBounds[0][i];
562+
sceneBounds[0][i] = sceneBounds[1][i];
563+
sceneBounds[1][i] = tmp;
564+
}
563565
} else {
564566
var range = axis.range;
565567
sceneBounds[0][i] = axis.r2l(range[0]);
90.6 KB
Loading
Loading
69.8 KB
Loading
+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
{
2+
"data": [
3+
{
4+
"x": [
5+
0.2
6+
],
7+
"y": [
8+
0.4
9+
],
10+
"z": [
11+
-0.6
12+
],
13+
"u": [
14+
1
15+
],
16+
"v": [
17+
1
18+
],
19+
"w": [
20+
0
21+
],
22+
"type": "cone"
23+
},
24+
{
25+
"x": [
26+
0.4
27+
],
28+
"y": [
29+
-0.6
30+
],
31+
"z": [
32+
0.2
33+
],
34+
"u": [
35+
1
36+
],
37+
"v": [
38+
0
39+
],
40+
"w": [
41+
1
42+
],
43+
"type": "cone"
44+
},
45+
{
46+
"x": [
47+
-0.6
48+
],
49+
"y": [
50+
0.2
51+
],
52+
"z": [
53+
0.4
54+
],
55+
"u": [
56+
0
57+
],
58+
"v": [
59+
1
60+
],
61+
"w": [
62+
1
63+
],
64+
"type": "cone"
65+
},
66+
{
67+
"x": [
68+
-0.2
69+
],
70+
"y": [
71+
-0.4
72+
],
73+
"z": [
74+
0.6
75+
],
76+
"u": [
77+
-1
78+
],
79+
"v": [
80+
-1
81+
],
82+
"w": [
83+
0
84+
],
85+
"type": "cone"
86+
},
87+
{
88+
"x": [
89+
-0.4
90+
],
91+
"y": [
92+
0.6
93+
],
94+
"z": [
95+
-0.2
96+
],
97+
"u": [
98+
-1
99+
],
100+
"v": [
101+
0
102+
],
103+
"w": [
104+
-1
105+
],
106+
"type": "cone"
107+
},
108+
{
109+
"x": [
110+
0.6
111+
],
112+
"y": [
113+
-0.2
114+
],
115+
"z": [
116+
-0.4
117+
],
118+
"u": [
119+
0
120+
],
121+
"v": [
122+
-1
123+
],
124+
"w": [
125+
-1
126+
],
127+
"type": "cone"
128+
}
129+
],
130+
"layout": {
131+
"height": 758,
132+
"width": 1310,
133+
"title": "Cone objects with Y-axis using autorange: 'reversed'",
134+
"scene": {
135+
"yaxis": {
136+
"autorange": "reversed"
137+
},
138+
"camera": {
139+
"eye": {
140+
"x": 1,
141+
"y": -1.5,
142+
"z": 1.25
143+
}
144+
}
145+
}
146+
}
147+
}

0 commit comments

Comments
 (0)