@@ -32,6 +32,7 @@ var computeTickMarks = require('./layout/tick_marks');
3232var STATIC_CANVAS , STATIC_CONTEXT ;
3333
3434function render ( scene ) {
35+ var gd = scene . graphDiv ;
3536 var trace ;
3637
3738 // update size of svg container
@@ -70,6 +71,7 @@ function render(scene) {
7071 if ( lastPicked !== null ) {
7172 var pdata = project ( scene . glplot . cameraParams , selection . dataCoordinate ) ;
7273 trace = lastPicked . data ;
74+ var traceNow = gd . _fullData [ trace . index ] ;
7375 var ptNumber = selection . index ;
7476
7577 var labels = {
@@ -78,11 +80,11 @@ function render(scene) {
7880 zLabel : formatter ( 'zaxis' , selection . traceCoordinate [ 2 ] )
7981 } ;
8082
81- var hoverinfo = Fx . castHoverinfo ( trace , scene . fullLayout , ptNumber ) ;
83+ var hoverinfo = Fx . castHoverinfo ( traceNow , scene . fullLayout , ptNumber ) ;
8284 var hoverinfoParts = ( hoverinfo || '' ) . split ( '+' ) ;
8385 var isHoverinfoAll = hoverinfo && hoverinfo === 'all' ;
8486
85- if ( ! trace . hovertemplate && ! isHoverinfoAll ) {
87+ if ( ! traceNow . hovertemplate && ! isHoverinfoAll ) {
8688 if ( hoverinfoParts . indexOf ( 'x' ) === - 1 ) labels . xLabel = undefined ;
8789 if ( hoverinfoParts . indexOf ( 'y' ) === - 1 ) labels . yLabel = undefined ;
8890 if ( hoverinfoParts . indexOf ( 'z' ) === - 1 ) labels . zLabel = undefined ;
@@ -138,55 +140,55 @@ function render(scene) {
138140 x : selection . traceCoordinate [ 0 ] ,
139141 y : selection . traceCoordinate [ 1 ] ,
140142 z : selection . traceCoordinate [ 2 ] ,
141- data : trace . _input ,
142- fullData : trace ,
143- curveNumber : trace . index ,
143+ data : traceNow . _input ,
144+ fullData : traceNow ,
145+ curveNumber : traceNow . index ,
144146 pointNumber : ptNumber
145147 } ;
146148
147- Fx . appendArrayPointValue ( pointData , trace , ptNumber ) ;
149+ Fx . appendArrayPointValue ( pointData , traceNow , ptNumber ) ;
148150
149151 if ( trace . _module . eventData ) {
150- pointData = trace . _module . eventData ( pointData , selection , trace , { } , ptNumber ) ;
152+ pointData = traceNow . _module . eventData ( pointData , selection , traceNow , { } , ptNumber ) ;
151153 }
152154
153155 var eventData = { points : [ pointData ] } ;
154156
155157 if ( scene . fullSceneLayout . hovermode ) {
156158 Fx . loneHover ( {
157- trace : trace ,
159+ trace : traceNow ,
158160 x : ( 0.5 + 0.5 * pdata [ 0 ] / pdata [ 3 ] ) * width ,
159161 y : ( 0.5 - 0.5 * pdata [ 1 ] / pdata [ 3 ] ) * height ,
160162 xLabel : labels . xLabel ,
161163 yLabel : labels . yLabel ,
162164 zLabel : labels . zLabel ,
163165 text : tx ,
164166 name : lastPicked . name ,
165- color : Fx . castHoverOption ( trace , ptNumber , 'bgcolor' ) || lastPicked . color ,
166- borderColor : Fx . castHoverOption ( trace , ptNumber , 'bordercolor' ) ,
167- fontFamily : Fx . castHoverOption ( trace , ptNumber , 'font.family' ) ,
168- fontSize : Fx . castHoverOption ( trace , ptNumber , 'font.size' ) ,
169- fontColor : Fx . castHoverOption ( trace , ptNumber , 'font.color' ) ,
170- hovertemplate : Lib . castOption ( trace , ptNumber , 'hovertemplate' ) ,
167+ color : Fx . castHoverOption ( traceNow , ptNumber , 'bgcolor' ) || lastPicked . color ,
168+ borderColor : Fx . castHoverOption ( traceNow , ptNumber , 'bordercolor' ) ,
169+ fontFamily : Fx . castHoverOption ( traceNow , ptNumber , 'font.family' ) ,
170+ fontSize : Fx . castHoverOption ( traceNow , ptNumber , 'font.size' ) ,
171+ fontColor : Fx . castHoverOption ( traceNow , ptNumber , 'font.color' ) ,
172+ nameLength : Fx . castHoverOption ( traceNow , ptNumber , 'namelength' ) ,
173+ hovertemplate : Lib . castOption ( traceNow , ptNumber , 'hovertemplate' ) ,
171174 hovertemplateLabels : Lib . extendFlat ( { } , pointData , labels ) ,
172175 eventData : [ pointData ]
173176 } , {
174177 container : svgContainer ,
175- gd : scene . graphDiv
178+ gd : gd
176179 } ) ;
177180 }
178181
179182 if ( selection . buttons && selection . distance < 5 ) {
180- scene . graphDiv . emit ( 'plotly_click' , eventData ) ;
183+ gd . emit ( 'plotly_click' , eventData ) ;
181184 } else {
182- scene . graphDiv . emit ( 'plotly_hover' , eventData ) ;
185+ gd . emit ( 'plotly_hover' , eventData ) ;
183186 }
184187
185188 oldEventData = eventData ;
186- }
187- else {
189+ } else {
188190 Fx . loneUnhover ( svgContainer ) ;
189- scene . graphDiv . emit ( 'plotly_unhover' , oldEventData ) ;
191+ gd . emit ( 'plotly_unhover' , oldEventData ) ;
190192 }
191193
192194 scene . drawAnnotations ( scene ) ;
0 commit comments