mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 05:30:35 +02:00
Set a drag threshold for reordering preset mode buttons in the ribbon (close #6040)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user