From 5c438bb2b2a367a1ca726d08aa8accd686a44e2b Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 18 Mar 2013 13:35:56 -0400 Subject: [PATCH] holding alignment button changes alignment --- js/id/ui/background.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/js/id/ui/background.js b/js/id/ui/background.js index 7daab1dbe..6bd38ad0e 100644 --- a/js/id/ui/background.js +++ b/js/id/ui/background.js @@ -223,9 +223,19 @@ iD.ui.Background = function(context) { .append('button') .attr('class', function(d) { return d[0] + ' nudge'; }) .text(function(d) { return d[0]; }) - .on('click', function(d) { - context.background().nudge(d[1], context.map().zoom()); - context.redraw(); + .on('mousedown', function(d) { + + var interval = window.setInterval(nudge, 100); + + d3.select(this).on('mouseup', function() { + window.clearInterval(interval); + nudge(); + }); + + function nudge() { + context.background().nudge(d[1], context.map().zoom()); + context.redraw(); + } }); nudge_container.append('button')