Skip to content

Commit 46ab63d

Browse files
committed
rm subplotId key from clickannotations event data when falsy
1 parent 1d5606a commit 46ab63d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/components/annotations/draw.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,19 @@ function drawRaw(gd, options, index, subplotId, xa, ya) {
133133
.call(setCursor, 'default')
134134
.on('click', function() {
135135
gd._dragging = false;
136-
gd.emit('plotly_clickannotation', {
136+
137+
var eventData = {
137138
index: index,
138-
subplotId: subplotId,
139139
annotation: options._input,
140140
fullAnnotation: options,
141141
event: d3.event
142-
});
142+
};
143+
144+
if(subplotId) {
145+
eventData.subplotId = subplotId;
146+
}
147+
148+
gd.emit('plotly_clickannotation', eventData);
143149
});
144150

145151
if(options.hovertext) {

0 commit comments

Comments
 (0)