@@ -32,6 +32,7 @@ var computeTickMarks = require('./layout/tick_marks');
32
32
var STATIC_CANVAS , STATIC_CONTEXT ;
33
33
34
34
function render ( scene ) {
35
+ var gd = scene . graphDiv ;
35
36
var trace ;
36
37
37
38
// update size of svg container
@@ -70,6 +71,7 @@ function render(scene) {
70
71
if ( lastPicked !== null ) {
71
72
var pdata = project ( scene . glplot . cameraParams , selection . dataCoordinate ) ;
72
73
trace = lastPicked . data ;
74
+ var traceNow = gd . _fullData [ trace . index ] ;
73
75
var ptNumber = selection . index ;
74
76
75
77
var labels = {
@@ -78,11 +80,11 @@ function render(scene) {
78
80
zLabel : formatter ( 'zaxis' , selection . traceCoordinate [ 2 ] )
79
81
} ;
80
82
81
- var hoverinfo = Fx . castHoverinfo ( trace , scene . fullLayout , ptNumber ) ;
83
+ var hoverinfo = Fx . castHoverinfo ( traceNow , scene . fullLayout , ptNumber ) ;
82
84
var hoverinfoParts = ( hoverinfo || '' ) . split ( '+' ) ;
83
85
var isHoverinfoAll = hoverinfo && hoverinfo === 'all' ;
84
86
85
- if ( ! trace . hovertemplate && ! isHoverinfoAll ) {
87
+ if ( ! traceNow . hovertemplate && ! isHoverinfoAll ) {
86
88
if ( hoverinfoParts . indexOf ( 'x' ) === - 1 ) labels . xLabel = undefined ;
87
89
if ( hoverinfoParts . indexOf ( 'y' ) === - 1 ) labels . yLabel = undefined ;
88
90
if ( hoverinfoParts . indexOf ( 'z' ) === - 1 ) labels . zLabel = undefined ;
@@ -138,55 +140,55 @@ function render(scene) {
138
140
x : selection . traceCoordinate [ 0 ] ,
139
141
y : selection . traceCoordinate [ 1 ] ,
140
142
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 ,
144
146
pointNumber : ptNumber
145
147
} ;
146
148
147
- Fx . appendArrayPointValue ( pointData , trace , ptNumber ) ;
149
+ Fx . appendArrayPointValue ( pointData , traceNow , ptNumber ) ;
148
150
149
151
if ( trace . _module . eventData ) {
150
- pointData = trace . _module . eventData ( pointData , selection , trace , { } , ptNumber ) ;
152
+ pointData = traceNow . _module . eventData ( pointData , selection , traceNow , { } , ptNumber ) ;
151
153
}
152
154
153
155
var eventData = { points : [ pointData ] } ;
154
156
155
157
if ( scene . fullSceneLayout . hovermode ) {
156
158
Fx . loneHover ( {
157
- trace : trace ,
159
+ trace : traceNow ,
158
160
x : ( 0.5 + 0.5 * pdata [ 0 ] / pdata [ 3 ] ) * width ,
159
161
y : ( 0.5 - 0.5 * pdata [ 1 ] / pdata [ 3 ] ) * height ,
160
162
xLabel : labels . xLabel ,
161
163
yLabel : labels . yLabel ,
162
164
zLabel : labels . zLabel ,
163
165
text : tx ,
164
166
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' ) ,
171
174
hovertemplateLabels : Lib . extendFlat ( { } , pointData , labels ) ,
172
175
eventData : [ pointData ]
173
176
} , {
174
177
container : svgContainer ,
175
- gd : scene . graphDiv
178
+ gd : gd
176
179
} ) ;
177
180
}
178
181
179
182
if ( selection . buttons && selection . distance < 5 ) {
180
- scene . graphDiv . emit ( 'plotly_click' , eventData ) ;
183
+ gd . emit ( 'plotly_click' , eventData ) ;
181
184
} else {
182
- scene . graphDiv . emit ( 'plotly_hover' , eventData ) ;
185
+ gd . emit ( 'plotly_hover' , eventData ) ;
183
186
}
184
187
185
188
oldEventData = eventData ;
186
- }
187
- else {
189
+ } else {
188
190
Fx . loneUnhover ( svgContainer ) ;
189
- scene . graphDiv . emit ( 'plotly_unhover' , oldEventData ) ;
191
+ gd . emit ( 'plotly_unhover' , oldEventData ) ;
190
192
}
191
193
192
194
scene . drawAnnotations ( scene ) ;
0 commit comments