From de3801d2c7f10d7239f58d50a75ac3b61c781bfc Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Mon, 8 May 2017 12:52:53 -0400 Subject: [PATCH 1/2] report mouse event in clickannotation --- src/components/annotations/draw.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/annotations/draw.js b/src/components/annotations/draw.js index 371af5ef0da..71a0b5c308a 100644 --- a/src/components/annotations/draw.js +++ b/src/components/annotations/draw.js @@ -112,7 +112,8 @@ function drawOne(gd, index) { gd.emit('plotly_clickannotation', { index: index, annotation: optionsIn, - fullAnnotation: options + fullAnnotation: options, + event: d3.event }); }); From 0a6ca106a4fb62115a9602b51ccffed3c57ddb56 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Mon, 8 May 2017 13:07:00 -0400 Subject: [PATCH 2/2] test clickannotation mouse event --- test/jasmine/tests/annotations_test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/jasmine/tests/annotations_test.js b/test/jasmine/tests/annotations_test.js index d5bf9b632e4..9bd99ef9d5b 100644 --- a/test/jasmine/tests/annotations_test.js +++ b/test/jasmine/tests/annotations_test.js @@ -1168,7 +1168,11 @@ describe('annotation effects', function() { ], {}) // turn off the default editable: true .then(function() { clickData = []; - gd.on('plotly_clickannotation', function(evt) { clickData.push(evt); }); + gd.on('plotly_clickannotation', function(evt) { + expect(evt.event).toEqual(jasmine.objectContaining({type: 'click'})); + delete evt.event; + clickData.push(evt); + }); gdBB = gd.getBoundingClientRect(); pos0Head = [gdBB.left + 200, gdBB.top + 200];