@@ -59,7 +59,6 @@ function zip3(x, y, z) {
59
59
}
60
60
61
61
var axisName2scaleIndex = { xaxis : 0 , yaxis : 1 , zaxis : 2 } ;
62
- var sizeMode2sizeKey = { scaled : 'coneSize' , absolute : 'absoluteConeSize' } ;
63
62
var anchor2coneOffset = { tip : 1 , tail : 0 , cm : 0.25 , center : 0.5 } ;
64
63
var anchor2coneSpan = { tip : 1 , tail : 1 , cm : 0.75 , center : 0.5 } ;
65
64
@@ -88,15 +87,21 @@ function convert(scene, trace) {
88
87
89
88
coneOpts . colormap = parseColorScale ( trace . colorscale ) ;
90
89
coneOpts . vertexIntensityBounds = [ trace . cmin / trace . _normMax , trace . cmax / trace . _normMax ] ;
91
-
92
- coneOpts [ sizeMode2sizeKey [ trace . sizemode ] ] = trace . sizeref ;
93
90
coneOpts . coneOffset = anchor2coneOffset [ trace . anchor ] ;
94
91
95
- var meshData = conePlot ( coneOpts ) ;
92
+ if ( trace . sizemode === 'scaled' ) {
93
+ // unitless sizeref
94
+ coneOpts . coneSize = trace . sizeref || 0.5 ;
95
+ } else {
96
+ // sizeref here has unit of velocity
97
+ coneOpts . coneSize = ( trace . sizeref / trace . _normMax ) || 0.5 ;
98
+ }
96
99
100
+ var meshData = conePlot ( coneOpts ) ;
97
101
98
102
// pass gl-mesh3d lighting attributes
99
- meshData . lightPosition = [ trace . lightposition . x , trace . lightposition . y , trace . lightposition . z ] ;
103
+ var lp = trace . lightposition ;
104
+ meshData . lightPosition = [ lp . x , lp . y , lp . z ] ;
100
105
meshData . ambient = trace . lighting . ambient ;
101
106
meshData . diffuse = trace . lighting . diffuse ;
102
107
meshData . specular = trace . lighting . specular ;
@@ -105,8 +110,7 @@ function convert(scene, trace) {
105
110
meshData . opacity = trace . opacity ;
106
111
107
112
// stash autorange pad value
108
- trace . _pad = anchor2coneSpan [ trace . anchor ] * meshData . vectorScale * trace . sizeref ;
109
- if ( trace . sizemode === 'scaled' ) trace . _pad *= trace . _normMax ;
113
+ trace . _pad = anchor2coneSpan [ trace . anchor ] * meshData . vectorScale * meshData . coneScale * trace . _normMax ;
110
114
111
115
return meshData ;
112
116
}
0 commit comments