@@ -1127,23 +1127,36 @@ describe('annotation effects', function() {
1127
1127
}
1128
1128
1129
1129
makePlot ( [
1130
- { x : 50 , y : 50 , text : 'hi' , width : 50 , ax : 0 , ay : - 20 } ,
1130
+ { x : 50 , y : 50 , text : 'hi' , width : 50 , ax : 0 , ay : - 40 } ,
1131
1131
{ x : 20 , y : 20 , text : 'bye' , height : 40 , showarrow : false } ,
1132
- { x : 80 , y : 80 , text : 'why?' , ax : 0 , ay : - 20 }
1132
+ { x : 80 , y : 80 , text : 'why?' , ax : 0 , ay : - 40 }
1133
1133
] , { } ) // turn off the default editable: true
1134
1134
. then ( function ( ) {
1135
1135
clickData = [ ] ;
1136
1136
gd . on ( 'plotly_clickannotation' , function ( evt ) { clickData . push ( evt ) ; } ) ;
1137
1137
1138
1138
gdBB = gd . getBoundingClientRect ( ) ;
1139
1139
pos0Head = [ gdBB . left + 250 , gdBB . top + 250 ] ;
1140
- pos0 = [ pos0Head [ 0 ] , pos0Head [ 1 ] - 20 ] ;
1140
+ pos0 = [ pos0Head [ 0 ] , pos0Head [ 1 ] - 40 ] ;
1141
1141
pos1 = [ gdBB . left + 160 , gdBB . top + 340 ] ;
1142
1142
pos2Head = [ gdBB . left + 340 , gdBB . top + 160 ] ;
1143
- pos2 = [ pos2Head [ 0 ] , pos2Head [ 1 ] - 20 ] ;
1143
+ pos2 = [ pos2Head [ 0 ] , pos2Head [ 1 ] - 40 ] ;
1144
1144
1145
1145
return assertHoverLabels ( [ [ pos0 , '' ] , [ pos1 , '' ] , [ pos2 , '' ] ] ) ;
1146
1146
} )
1147
+ // not going to register either of these because captureevents is off
1148
+ . then ( function ( ) { return _click ( pos1 ) ; } )
1149
+ . then ( function ( ) { return _click ( pos2Head ) ; } )
1150
+ . then ( function ( ) {
1151
+ assertClickData ( [ ] ) ;
1152
+
1153
+ return Plotly . relayout ( gd , {
1154
+ 'annotations[1].captureevents' : true ,
1155
+ 'annotations[2].captureevents' : true
1156
+ } ) ;
1157
+ } )
1158
+ // now we'll register the click on #1, but still not on #2
1159
+ // because we're clicking the head, not the text box
1147
1160
. then ( function ( ) { return _click ( pos1 ) ; } )
1148
1161
. then ( function ( ) { return _click ( pos2Head ) ; } )
1149
1162
. then ( function ( ) {
@@ -1168,6 +1181,7 @@ describe('annotation effects', function() {
1168
1181
'0 only' ) ;
1169
1182
} )
1170
1183
// click and hover work together?
1184
+ // this also tests that hover turns on annotation.captureevents
1171
1185
. then ( function ( ) { return _click ( pos0 ) ; } )
1172
1186
. then ( function ( ) {
1173
1187
assertClickData ( [ {
0 commit comments