From 83aec5809192a4a3f812204ccce53c46775ddb1c Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Tue, 12 Mar 2019 10:56:54 -0400 Subject: [PATCH] Set a drag threshold for reordering preset mode buttons in the ribbon (close #6040) --- modules/ui/modes.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/ui/modes.js b/modules/ui/modes.js index 78a0386ba..07284f26c 100644 --- a/modules/ui/modes.js +++ b/modules/ui/modes.js @@ -226,6 +226,10 @@ export function uiModes(context) { var x = d3_event.x - dragOrigin.x, y = d3_event.y - dragOrigin.y; + if (!d3_select(this).classed('dragging') && + // don't display drag until dragging beyond a distance threshold + Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)) <= 5) return; + d3_select(this) .classed('dragging', true) .classed('removing', y > 50); @@ -268,6 +272,8 @@ export function uiModes(context) { }) .on('end', function(d, index) { + if (!d3_select(this).classed('dragging')) return; + d3_select(this) .classed('dragging', false) .classed('removing', false);