File tree 2 files changed +38
-1
lines changed
2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,9 @@ function convert(scene, trace) {
94
94
coneOpts . coneSize = trace . sizeref || 0.5 ;
95
95
} else {
96
96
// sizeref here has unit of velocity
97
- coneOpts . coneSize = ( trace . sizeref / trace . _normMax ) || 0.5 ;
97
+ coneOpts . coneSize = trace . sizeref && trace . _normMax ?
98
+ trace . sizeref / trace . _normMax :
99
+ 0.5 ;
98
100
}
99
101
100
102
var meshData = conePlot ( coneOpts ) ;
Original file line number Diff line number Diff line change @@ -219,6 +219,41 @@ describe('@gl Test cone interactions', function() {
219
219
. then ( done ) ;
220
220
} ) ;
221
221
222
+ it ( 'should not pass zero or infinite `coneSize` to gl-cone3d' , function ( done ) {
223
+ var base = {
224
+ type : 'cone' ,
225
+ x : [ 1 , 2 , 3 ] ,
226
+ y : [ 1 , 2 , 3 ] ,
227
+ z : [ 1 , 2 , 3 ] ,
228
+ u : [ 1 , 0 , 0 ] ,
229
+ v : [ 0 , 1 , 0 ] ,
230
+ w : [ 0 , 0 , 1 ]
231
+ } ;
232
+
233
+ Plotly . newPlot ( gd , [
234
+ Lib . extendDeep ( { } , base ) ,
235
+ Lib . extendDeep ( { } , base , {
236
+ sizemode : 'absolute'
237
+ } ) ,
238
+ Lib . extendDeep ( { } , base , {
239
+ sizemode : 'absolute' ,
240
+ u : [ 0 , 0 , 0 ] ,
241
+ v : [ 0 , 0 , 0 ] ,
242
+ w : [ 0 , 0 , 0 ]
243
+ } ) ,
244
+ ] )
245
+ . then ( function ( ) {
246
+ var scene = gd . _fullLayout . scene . _scene ;
247
+ var objs = scene . glplot . objects ;
248
+
249
+ expect ( objs [ 0 ] . coneScale ) . toBe ( 0.5 , 'base case' ) ;
250
+ expect ( objs [ 1 ] . coneScale ) . toBe ( 0.5 , 'absolute case' ) ;
251
+ expect ( objs [ 2 ] . coneScale ) . toBe ( 0.5 , 'absolute + 0-norm case' ) ;
252
+ } )
253
+ . catch ( failTest )
254
+ . then ( done ) ;
255
+ } ) ;
256
+
222
257
it ( 'should display hover labels' , function ( done ) {
223
258
var fig = Lib . extendDeep ( { } , require ( '@mocks/gl3d_cone-simple.json' ) ) ;
224
259
// only one trace on one scene
You can’t perform that action at this time.
0 commit comments