@@ -59,7 +59,6 @@ function zip3(x, y, z) {
5959}
6060
6161var axisName2scaleIndex = { xaxis : 0 , yaxis : 1 , zaxis : 2 } ;
62- var sizeMode2sizeKey = { scaled : 'coneSize' , absolute : 'absoluteConeSize' } ;
6362var anchor2coneOffset = { tip : 1 , tail : 0 , cm : 0.25 , center : 0.5 } ;
6463var anchor2coneSpan = { tip : 1 , tail : 1 , cm : 0.75 , center : 0.5 } ;
6564
@@ -88,15 +87,21 @@ function convert(scene, trace) {
8887
8988 coneOpts . colormap = parseColorScale ( trace . colorscale ) ;
9089 coneOpts . vertexIntensityBounds = [ trace . cmin / trace . _normMax , trace . cmax / trace . _normMax ] ;
91-
92- coneOpts [ sizeMode2sizeKey [ trace . sizemode ] ] = trace . sizeref ;
9390 coneOpts . coneOffset = anchor2coneOffset [ trace . anchor ] ;
9491
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+ }
9699
100+ var meshData = conePlot ( coneOpts ) ;
97101
98102 // 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 ] ;
100105 meshData . ambient = trace . lighting . ambient ;
101106 meshData . diffuse = trace . lighting . diffuse ;
102107 meshData . specular = trace . lighting . specular ;
@@ -105,8 +110,7 @@ function convert(scene, trace) {
105110 meshData . opacity = trace . opacity ;
106111
107112 // 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 ;
110114
111115 return meshData ;
112116}
0 commit comments