Skip to content

Commit 22f0c7e

Browse files
committed
sub startx/starty/startz -> starts.(x|y|z)
1 parent 9a53250 commit 22f0c7e

10 files changed

+358
-344
lines changed

Diff for: src/traces/streamtube/attributes.js

+22-20
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,28 @@ var attrs = {
5252
description: 'Sets the z components of the vector field.'
5353
},
5454

55-
startx: {
56-
valType: 'data_array',
57-
editType: 'calc',
58-
description: [
59-
'Sets the x components of the starting position of the streamtubes',
60-
].join(' ')
61-
},
62-
starty: {
63-
valType: 'data_array',
64-
editType: 'calc',
65-
description: [
66-
'Sets the y components of the starting position of the streamtubes',
67-
].join(' ')
68-
},
69-
startz: {
70-
valType: 'data_array',
71-
editType: 'calc',
72-
description: [
73-
'Sets the z components of the starting position of the streamtubes',
74-
].join(' ')
55+
starts: {
56+
x: {
57+
valType: 'data_array',
58+
editType: 'calc',
59+
description: [
60+
'Sets the x components of the starting position of the streamtubes',
61+
].join(' ')
62+
},
63+
y: {
64+
valType: 'data_array',
65+
editType: 'calc',
66+
description: [
67+
'Sets the y components of the starting position of the streamtubes',
68+
].join(' ')
69+
},
70+
z: {
71+
valType: 'data_array',
72+
editType: 'calc',
73+
description: [
74+
'Sets the z components of the starting position of the streamtubes',
75+
].join(' ')
76+
}
7577
},
7678

7779
maxdisplayed: {

Diff for: src/traces/streamtube/calc.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ module.exports = function calc(gd, trace) {
2121
var z = trace.z;
2222
var len = Math.min(x.length, y.length, z.length, u.length, v.length, w.length);
2323

24-
var startx = trace.startx || [];
25-
var starty = trace.starty || [];
26-
var startz = trace.startz || [];
27-
var slen = Math.min(startx.length, starty.length, startz.length);
24+
var slen = 0;
25+
var startx, starty, startz;
26+
if(trace.starts) {
27+
startx = trace.starts.x || [];
28+
starty = trace.starts.y || [];
29+
startz = trace.starts.z || [];
30+
slen = Math.min(startx.length, starty.length, startz.length);
31+
}
2832

2933
var normMax = 0;
3034
var normMin = Infinity;

Diff for: src/traces/streamtube/convert.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ function convert(scene, trace) {
107107

108108
tubeOpts.meshgrid = [meshx, meshy, meshz];
109109

110-
if(trace.startx && trace.starty && trace.startz) {
110+
if(trace.starts) {
111111
var slen = trace._slen;
112112
tubeOpts.startingPositions = zip3(
113-
toDataCoords(trace.startx.slice(0, slen), 'xaxis'),
114-
toDataCoords(trace.starty.slice(0, slen), 'yaxis'),
115-
toDataCoords(trace.startz.slice(0, slen), 'zaxis')
113+
toDataCoords(trace.starts.x.slice(0, slen), 'xaxis'),
114+
toDataCoords(trace.starts.y.slice(0, slen), 'yaxis'),
115+
toDataCoords(trace.starts.z.slice(0, slen), 'zaxis')
116116
);
117117
} else {
118118
// Default starting positions: cut xz plane at min-y,

Diff for: src/traces/streamtube/defaults.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3434
return;
3535
}
3636

37-
coerce('startx');
38-
coerce('starty');
39-
coerce('startz');
37+
coerce('starts.x');
38+
coerce('starts.y');
39+
coerce('starts.z');
4040

4141
coerce('maxdisplayed');
4242
coerce('sizeref');
@@ -56,6 +56,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
5656

5757
// disable 1D transforms (for now)
5858
// x/y/z and u/v/w have matching lengths,
59-
// but they don't have to match with start(x|y|z)
59+
// but they don't have to match with starts.(x|y|z)
6060
traceOut._length = null;
6161
};

Diff for: src/traces/streamtube/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ module.exports = {
4949
'',
5050
'By default, the tubes\' starting positions will be cut from the vector field\'s',
5151
'x-z plane at its minimum y value.',
52-
'To specify your own starting position, use attributes `startx`, `starty`',
53-
'and `startz`.'
52+
'To specify your own starting position, use attributes `starts.x`, `starts.y`',
53+
'and `starts.z`.'
5454
].join(' ')
5555
}
5656
};

Diff for: test/image/mocks/gl3d_cone-with-streamtube.json

+56-54
Original file line numberDiff line numberDiff line change
@@ -135648,60 +135648,62 @@
135648135648
-0.25592,
135649135649
-0.61511
135650135650
],
135651-
"startx": [
135652-
80,
135653-
80,
135654-
80,
135655-
80,
135656-
80,
135657-
80,
135658-
80,
135659-
80,
135660-
80,
135661-
80,
135662-
80,
135663-
80,
135664-
80,
135665-
80,
135666-
80,
135667-
80
135668-
],
135669-
"starty": [
135670-
20,
135671-
30,
135672-
40,
135673-
50,
135674-
20,
135675-
30,
135676-
40,
135677-
50,
135678-
20,
135679-
30,
135680-
40,
135681-
50,
135682-
20,
135683-
30,
135684-
40,
135685-
50
135686-
],
135687-
"startz": [
135688-
0,
135689-
0,
135690-
0,
135691-
0,
135692-
5,
135693-
5,
135694-
5,
135695-
5,
135696-
10,
135697-
10,
135698-
10,
135699-
10,
135700-
15,
135701-
15,
135702-
15,
135703-
15
135704-
],
135651+
"starts": {
135652+
"x": [
135653+
80,
135654+
80,
135655+
80,
135656+
80,
135657+
80,
135658+
80,
135659+
80,
135660+
80,
135661+
80,
135662+
80,
135663+
80,
135664+
80,
135665+
80,
135666+
80,
135667+
80,
135668+
80
135669+
],
135670+
"y": [
135671+
20,
135672+
30,
135673+
40,
135674+
50,
135675+
20,
135676+
30,
135677+
40,
135678+
50,
135679+
20,
135680+
30,
135681+
40,
135682+
50,
135683+
20,
135684+
30,
135685+
40,
135686+
50
135687+
],
135688+
"z": [
135689+
0,
135690+
0,
135691+
0,
135692+
0,
135693+
5,
135694+
5,
135695+
5,
135696+
5,
135697+
10,
135698+
10,
135699+
10,
135700+
10,
135701+
15,
135702+
15,
135703+
15,
135704+
15
135705+
]
135706+
},
135705135707
"sizeref": 0.6,
135706135708
"colorscale": "Portland",
135707135709
"showscale": false,

0 commit comments

Comments
 (0)