Set a drag threshold for reordering preset mode buttons in the ribbon (close #6040)

This commit is contained in:
Quincy Morgan
2019-03-12 10:56:54 -04:00
parent a076c54ed5
commit 83aec58091
+6
View File
@@ -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);