highcharts / highcharts/draggable-points
Drop events are triggered by single clicks
- Dominant language
- JavaScript
- Stars
- 32
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Description
Drop events sometimes fire without preceding dragging, i.e. by a single click. This can be reproduced in the demo fiddle http://jsfiddle.net/highcharts/AyUbx/ like this:
1. Drag and drop the Jan value of series 3 to - say - 200.
2. Move the cursor to some location above the Feb columns, so that the Feb tooltip opens. The cursor does not need to switch to ns-resize.
3. Perform a single click.
As result, the #drop div displays something like "In Series 3, 1 was set to 71.50".
Although the Feb value does not change, this behavior is problematic if your drop callback performs something like changing the marker attributes.
As a workaround, one can define a drag event that sets a wasDragged flag, and have the drop event test that flag before performing the actual action:
events: {
drag: function () {
wasDragged = true;
},
drop: function() {
if ( wasDragged == true ) {
wasDragged = false;
// drop code goes here
};
}
}
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.