draggable-points icon indicating copy to clipboard operation
draggable-points copied to clipboard

Drop events are triggered by single clicks

Open ThorstenPeter opened this issue 11 years ago • 1 comments

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 }; } }

ThorstenPeter avatar Mar 13 '14 10:03 ThorstenPeter

Some problems remains:

description:

with draggable options activated on the x-axis of a series, a single click on a point generates a DROP events with a negative shift on the x-axis only when categorical values on x-axis

step to reproduce based on http://jsfiddle.net/highcharts/AyUbx/ :

1 / single click generates a drop on serie 3

when you add draggableX: true, to serie 3

a single click on a point from series 3 will generate a drop with a shift of -.0.5 on the x axis

2/ not reproduced when deleting the 2 first series and keeping series 3

    series: [ {
        data: [0, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
        draggableX: true,
        draggableY: true
    }]

3/ reproduced with categorical x-axis

i.e. deleting the 2 first series and keeping series 3 and uncommenting the categories on the xAxis

    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },
...

    series: [ {
        data: [0, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
        draggableX: true,
        draggableY: true
    }]

danreb25 avatar Jun 11 '14 04:06 danreb25