From d17f22eb7dde299c8b763a092dcd4900673f974a Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 7 May 2016 00:19:06 -0400 Subject: [PATCH] Keep move cursor while adjusting imagery offset (closes #3101) --- css/app.css | 11 +++++++++++ js/id/ui/background.js | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/css/app.css b/css/app.css index 22f85f441..a75cc97de 100644 --- a/css/app.css +++ b/css/app.css @@ -2042,6 +2042,17 @@ div.full-screen > button:hover { right: -10px; } +.nudge-surface { + position: absolute; + z-index: 5000; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: transparent; + cursor: move; +} + .background-control .nudge.right::after { border-top: 5px solid transparent; border-bottom: 5px solid transparent; diff --git a/js/id/ui/background.js b/js/id/ui/background.js index d516291d8..23076f025 100644 --- a/js/id/ui/background.js +++ b/js/id/ui/background.js @@ -204,6 +204,10 @@ iD.ui.Background = function(context) { function dragOffset() { var origin = [d3.event.clientX, d3.event.clientY]; + context.container() + .append('div') + .attr('class', 'nudge-surface'); + d3.select(window) .on('mousemove.offset', function() { var latest = [d3.event.clientX, d3.event.clientY]; @@ -216,6 +220,9 @@ iD.ui.Background = function(context) { nudge(d); }) .on('mouseup.offset', function() { + d3.selectAll('.nudge-surface') + .remove(); + d3.select(window) .on('mousemove.offset', null) .on('mouseup.offset', null);