From 24802c93990f8986793ce692c773fa06640c4598 Mon Sep 17 00:00:00 2001 From: Paul Annekov Date: Fri, 10 Jul 2015 23:44:03 +0300 Subject: [PATCH 01/11] Added button to switch to full screen mode --- css/app.css | 1 - dist/locales/en.json | 3 +++ index.html | 1 + js/id/ui.js | 4 +++ js/id/ui/full_screen.js | 60 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 js/id/ui/full_screen.js diff --git a/css/app.css b/css/app.css index c2cb031d4..08d939ccd 100644 --- a/css/app.css +++ b/css/app.css @@ -29,7 +29,6 @@ body { .id-container { height: 100%; width: 100%; - position: fixed; min-width: 768px; } diff --git a/dist/locales/en.json b/dist/locales/en.json index 94adb4e45..c401c721d 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -430,6 +430,9 @@ "help": "Another user changed some of the same map features you changed.\nClick on each item below for more details about the conflict, and choose whether to keep\nyour changes or the other user's changes.\n" } }, + "full_screen": { + "title": "Full Screen" + }, "merge_remote_changes": { "conflict": { "deleted": "This object has been deleted by {user}.", diff --git a/index.html b/index.html index cf71e0b9e..b54c337c6 100644 --- a/index.html +++ b/index.html @@ -99,6 +99,7 @@ + diff --git a/js/id/ui.js b/js/id/ui.js index 6d8534501..59f4f02d8 100644 --- a/js/id/ui.js +++ b/js/id/ui.js @@ -60,6 +60,10 @@ iD.ui = function(context) { .attr('class', 'button-wrap col1') .call(iD.ui.Save(context)); + limiter.append('div') + .attr('class', 'button-wrap col1') + .call(iD.ui.FullScreen(context)); + bar.append('div') .attr('class', 'spinner') .call(iD.ui.Spinner(context)); diff --git a/js/id/ui/full_screen.js b/js/id/ui/full_screen.js new file mode 100644 index 000000000..e5a01352d --- /dev/null +++ b/js/id/ui/full_screen.js @@ -0,0 +1,60 @@ +iD.ui.FullScreen = function(context) { + var history = context.history(), + key = iD.ui.cmd('⌘S'); + + function saving() { + return context.mode().id === 'save'; + } + + function fullScreen() { + d3.event.preventDefault(); + context.container().node().webkitRequestFullscreen(); + } + + return function(selection) { + /*var tooltip = bootstrap.tooltip() + .placement('bottom') + .html(true) + .title(iD.ui.tooltipHtml(t('save.no_changes'), key));*/ + + var button = selection.append('button') + .attr('class', 'save col12') + .attr('tabindex', -1) + .on('click', fullScreen) + /*.call(tooltip)*/; + + button.append('span') + .attr('class', 'label') + .text(t('full_screen.title')); + + /*var keybinding = d3.keybinding('undo-redo') + .on(key, save, true);*/ + + /*d3.select(document) + .call(keybinding);*/ + + var numChanges = 0; + + context.history().on('change.save', function() { + var _ = history.difference().summary().length; + if (_ === numChanges) + return; + numChanges = _; + + tooltip.title(iD.ui.tooltipHtml(t(numChanges > 0 ? + 'save.help' : 'save.no_changes'), key)); + + button + .classed('disabled', numChanges === 0) + .classed('has-count', numChanges > 0); + + button.select('span.count') + .text(numChanges); + }); + + context.on('enter.save', function() { + button.property('disabled', saving()); + if (saving()) button.call(tooltip.hide); + }); + }; +}; From 61ac67ac6ca1530c95682b992d0431e0607fa82a Mon Sep 17 00:00:00 2001 From: Paul Annekov Date: Sat, 11 Jul 2015 10:21:49 +0300 Subject: [PATCH 02/11] Added tooltip, cross browser requestFullScreen call and key binding --- dist/locales/en.json | 3 ++- js/id/ui/full_screen.js | 49 ++++++++++++++++++++++++++++------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/dist/locales/en.json b/dist/locales/en.json index c401c721d..f264d0416 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -431,7 +431,8 @@ } }, "full_screen": { - "title": "Full Screen" + "title": "Full Screen", + "tooltip": "Go to Full Screen mode" }, "merge_remote_changes": { "conflict": { diff --git a/js/id/ui/full_screen.js b/js/id/ui/full_screen.js index e5a01352d..ae7f79177 100644 --- a/js/id/ui/full_screen.js +++ b/js/id/ui/full_screen.js @@ -1,39 +1,58 @@ iD.ui.FullScreen = function(context) { - var history = context.history(), - key = iD.ui.cmd('⌘S'); + var element = context.container().node(), + key = iD.ui.cmd('⌃f11'); - function saving() { + /*function saving() { return context.mode().id === 'save'; + }*/ + + function getFullScreenFn() { + var prefixes = ['moz', 'webkit', 'ms']; + if (element.requestFullscreen) + return element.requestFullscreen; + + for (var i = 0; i < prefixes.length; i++) { + var fn = element[prefixes[i] + 'RequestFullScreen']; + if (fn) + return fn; + } + } + + function is_supported() { + return !!getFullScreenFn(); } function fullScreen() { d3.event.preventDefault(); - context.container().node().webkitRequestFullscreen(); + getFullScreenFn().apply(element); } return function(selection) { - /*var tooltip = bootstrap.tooltip() + if (!is_supported()) + return; + + var tooltip = bootstrap.tooltip() .placement('bottom') .html(true) - .title(iD.ui.tooltipHtml(t('save.no_changes'), key));*/ + .title(iD.ui.tooltipHtml(t('full_screen.tooltip'), key)); var button = selection.append('button') .attr('class', 'save col12') .attr('tabindex', -1) .on('click', fullScreen) - /*.call(tooltip)*/; + .call(tooltip); button.append('span') .attr('class', 'label') .text(t('full_screen.title')); - /*var keybinding = d3.keybinding('undo-redo') - .on(key, save, true);*/ + var keybinding = d3.keybinding('full-screen') + .on(key, fullScreen, true); - /*d3.select(document) - .call(keybinding);*/ + d3.select(document) + .call(keybinding); - var numChanges = 0; + /*var numChanges = 0; context.history().on('change.save', function() { var _ = history.difference().summary().length; @@ -50,11 +69,11 @@ iD.ui.FullScreen = function(context) { button.select('span.count') .text(numChanges); - }); + });*/ - context.on('enter.save', function() { + /*context.on('enter.save', function() { button.property('disabled', saving()); if (saving()) button.call(tooltip.hide); - }); + });*/ }; }; From 1a3c75da2b33bc7f962edfb4201e12be7820da6a Mon Sep 17 00:00:00 2001 From: Paul Annekov Date: Sat, 11 Jul 2015 20:26:50 +0300 Subject: [PATCH 03/11] Added ability to exit from full screen --- js/id/ui/full_screen.js | 76 +++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 45 deletions(-) diff --git a/js/id/ui/full_screen.js b/js/id/ui/full_screen.js index ae7f79177..6d51f8702 100644 --- a/js/id/ui/full_screen.js +++ b/js/id/ui/full_screen.js @@ -1,30 +1,46 @@ iD.ui.FullScreen = function(context) { - var element = context.container().node(), - key = iD.ui.cmd('⌃f11'); - - /*function saving() { - return context.mode().id === 'save'; - }*/ + var element = context.container().node(); function getFullScreenFn() { - var prefixes = ['moz', 'webkit', 'ms']; - if (element.requestFullscreen) + if (element.requestFullscreen) { return element.requestFullscreen; - - for (var i = 0; i < prefixes.length; i++) { - var fn = element[prefixes[i] + 'RequestFullScreen']; - if (fn) - return fn; + } else if (element.msRequestFullscreen) { + return element.msRequestFullscreen; + } else if (element.mozRequestFullScreen) { + return element.mozRequestFullScreen; + } else if (element.webkitRequestFullscreen) { + return element.webkitRequestFullscreen; } } + function getExitFullScreenFn() { + if (document.exitFullscreen) { + return document.exitFullscreen; + } else if (document.msExitFullscreen) { + return document.msExitFullscreen; + } else if (document.mozCancelFullScreen) { + return document.mozCancelFullScreen; + } else if (document.webkitExitFullscreen) { + return document.webkitExitFullscreen; + } + } + + function isFullScreen() { + return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement + || document.msFullscreenElement; + } + function is_supported() { return !!getFullScreenFn(); } function fullScreen() { d3.event.preventDefault(); - getFullScreenFn().apply(element); + if (!isFullScreen()) { + getFullScreenFn().apply(element); + } else { + getExitFullScreenFn().apply(document); + } } return function(selection) { @@ -34,7 +50,7 @@ iD.ui.FullScreen = function(context) { var tooltip = bootstrap.tooltip() .placement('bottom') .html(true) - .title(iD.ui.tooltipHtml(t('full_screen.tooltip'), key)); + .title(iD.ui.tooltipHtml(t('full_screen.tooltip'))); var button = selection.append('button') .attr('class', 'save col12') @@ -45,35 +61,5 @@ iD.ui.FullScreen = function(context) { button.append('span') .attr('class', 'label') .text(t('full_screen.title')); - - var keybinding = d3.keybinding('full-screen') - .on(key, fullScreen, true); - - d3.select(document) - .call(keybinding); - - /*var numChanges = 0; - - context.history().on('change.save', function() { - var _ = history.difference().summary().length; - if (_ === numChanges) - return; - numChanges = _; - - tooltip.title(iD.ui.tooltipHtml(t(numChanges > 0 ? - 'save.help' : 'save.no_changes'), key)); - - button - .classed('disabled', numChanges === 0) - .classed('has-count', numChanges > 0); - - button.select('span.count') - .text(numChanges); - });*/ - - /*context.on('enter.save', function() { - button.property('disabled', saving()); - if (saving()) button.call(tooltip.hide); - });*/ }; }; From 8a933a5fa54e6b46690b0ffbd47b1b2a2e200aeb Mon Sep 17 00:00:00 2001 From: Paul Annekov Date: Sat, 11 Jul 2015 20:42:46 +0300 Subject: [PATCH 04/11] Moved the button, updated text --- css/app.css | 9 ++++++++- dist/locales/en.json | 4 ++-- js/id/ui.js | 8 ++++---- js/id/ui/full_screen.js | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/css/app.css b/css/app.css index 08d939ccd..e093d234b 100644 --- a/css/app.css +++ b/css/app.css @@ -63,13 +63,20 @@ body { position: absolute; height: 40px; width: 40px; - right: 10px; + right: 50px; top: 10px; border-radius: 4px; margin-right: 10px; background: black; } +.full-screen { + position: absolute; + width: 40px; + right: 10px; + top: 10px; +} + div, textarea, label, input, form, span, ul, li, ol, a, button, h1, h2, h3, h4, h5, p, img { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; diff --git a/dist/locales/en.json b/dist/locales/en.json index f264d0416..340077464 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -431,8 +431,8 @@ } }, "full_screen": { - "title": "Full Screen", - "tooltip": "Go to Full Screen mode" + "title": "FS", + "tooltip": "Toggle Full Screen mode" }, "merge_remote_changes": { "conflict": { diff --git a/js/id/ui.js b/js/id/ui.js index 59f4f02d8..4d4f80780 100644 --- a/js/id/ui.js +++ b/js/id/ui.js @@ -60,14 +60,14 @@ iD.ui = function(context) { .attr('class', 'button-wrap col1') .call(iD.ui.Save(context)); - limiter.append('div') - .attr('class', 'button-wrap col1') - .call(iD.ui.FullScreen(context)); - bar.append('div') .attr('class', 'spinner') .call(iD.ui.Spinner(context)); + bar.append('div') + .attr('class', 'full-screen') + .call(iD.ui.FullScreen(context)); + var controls = bar.append('div') .attr('class', 'map-controls'); diff --git a/js/id/ui/full_screen.js b/js/id/ui/full_screen.js index 6d51f8702..90fa798be 100644 --- a/js/id/ui/full_screen.js +++ b/js/id/ui/full_screen.js @@ -48,7 +48,7 @@ iD.ui.FullScreen = function(context) { return; var tooltip = bootstrap.tooltip() - .placement('bottom') + .placement('left') .html(true) .title(iD.ui.tooltipHtml(t('full_screen.tooltip'))); From fb1af6afe3e45cc93a7655fb3bbb5d81231e1dc3 Mon Sep 17 00:00:00 2001 From: Paul Annekov Date: Wed, 22 Jul 2015 00:14:48 +0300 Subject: [PATCH 05/11] Added icons, changed button style. --- css/app.css | 21 ++++++++++- dist/img/fullscreen_exit.svg | 64 +++++++++++++++++++++++++++++++++ dist/img/fullscreen_request.svg | 64 +++++++++++++++++++++++++++++++++ dist/locales/en.json | 3 +- js/id/ui/full_screen.js | 17 ++++----- 5 files changed, 156 insertions(+), 13 deletions(-) create mode 100644 dist/img/fullscreen_exit.svg create mode 100644 dist/img/fullscreen_request.svg diff --git a/css/app.css b/css/app.css index e093d234b..01134f272 100644 --- a/css/app.css +++ b/css/app.css @@ -70,13 +70,32 @@ body { background: black; } -.full-screen { +div.full-screen { position: absolute; width: 40px; right: 10px; top: 10px; } +button.full-screen { + width: 100%; + position: relative; +} + +button.full-screen, button.full-screen.active { + width: 40px; + height: 40px; + background: transparent url(img/fullscreen_request.svg) no-repeat center; +} + +button.full-screen.active { + background-image: url(img/fullscreen_exit.svg); +} + +button.full-screen:hover, button.full-screen:focus { + background-color: rgba(0, 0, 0, .8); +} + div, textarea, label, input, form, span, ul, li, ol, a, button, h1, h2, h3, h4, h5, p, img { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; diff --git a/dist/img/fullscreen_exit.svg b/dist/img/fullscreen_exit.svg new file mode 100644 index 000000000..8608ceb52 --- /dev/null +++ b/dist/img/fullscreen_exit.svg @@ -0,0 +1,64 @@ + +image/svg+xml \ No newline at end of file diff --git a/dist/img/fullscreen_request.svg b/dist/img/fullscreen_request.svg new file mode 100644 index 000000000..fbdc9874c --- /dev/null +++ b/dist/img/fullscreen_request.svg @@ -0,0 +1,64 @@ + +image/svg+xml \ No newline at end of file diff --git a/dist/locales/en.json b/dist/locales/en.json index 340077464..6eefaada4 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -431,8 +431,7 @@ } }, "full_screen": { - "title": "FS", - "tooltip": "Toggle Full Screen mode" + "tooltip": "Toggle Full Screen" }, "merge_remote_changes": { "conflict": { diff --git a/js/id/ui/full_screen.js b/js/id/ui/full_screen.js index 90fa798be..e2fec1347 100644 --- a/js/id/ui/full_screen.js +++ b/js/id/ui/full_screen.js @@ -1,5 +1,5 @@ iD.ui.FullScreen = function(context) { - var element = context.container().node(); + var element = context.container().node(), button; function getFullScreenFn() { if (element.requestFullscreen) { @@ -37,8 +37,10 @@ iD.ui.FullScreen = function(context) { function fullScreen() { d3.event.preventDefault(); if (!isFullScreen()) { + button.classed('active', true); getFullScreenFn().apply(element); } else { + button.classed('active', false); getExitFullScreenFn().apply(document); } } @@ -48,18 +50,13 @@ iD.ui.FullScreen = function(context) { return; var tooltip = bootstrap.tooltip() - .placement('left') - .html(true) - .title(iD.ui.tooltipHtml(t('full_screen.tooltip'))); + .placement('left'); - var button = selection.append('button') - .attr('class', 'save col12') + button = selection.append('button') + .attr('class', 'full-screen') + .attr('title', t('full_screen.tooltip')) .attr('tabindex', -1) .on('click', fullScreen) .call(tooltip); - - button.append('span') - .attr('class', 'label') - .text(t('full_screen.title')); }; }; From 739876de99c1bb1fbb00f71faba728342df85e03 Mon Sep 17 00:00:00 2001 From: Paul Annekov Date: Thu, 23 Jul 2015 22:30:14 +0300 Subject: [PATCH 06/11] Images to sprite, fixed tooltip position, fixed spinner position if fullscreen is not supported --- css/app.css | 54 +++++++++++----------- dist/img/fullscreen_exit.svg | 64 -------------------------- dist/img/fullscreen_request.svg | 64 -------------------------- dist/img/sprite.svg | 80 ++++++++++++++++++++++++++++++--- dist/locales/en.json | 4 +- js/id/ui.js | 8 ++-- js/id/ui/full_screen.js | 10 +++-- 7 files changed, 110 insertions(+), 174 deletions(-) delete mode 100644 dist/img/fullscreen_exit.svg delete mode 100644 dist/img/fullscreen_request.svg diff --git a/css/app.css b/css/app.css index 01134f272..ec6daa726 100644 --- a/css/app.css +++ b/css/app.css @@ -57,45 +57,17 @@ body { .spinner { opacity: .5; + float: right; } .spinner img { - position: absolute; height: 40px; width: 40px; - right: 50px; - top: 10px; border-radius: 4px; margin-right: 10px; background: black; } -div.full-screen { - position: absolute; - width: 40px; - right: 10px; - top: 10px; -} - -button.full-screen { - width: 100%; - position: relative; -} - -button.full-screen, button.full-screen.active { - width: 40px; - height: 40px; - background: transparent url(img/fullscreen_request.svg) no-repeat center; -} - -button.full-screen.active { - background-image: url(img/fullscreen_exit.svg); -} - -button.full-screen:hover, button.full-screen:focus { - background-color: rgba(0, 0, 0, .8); -} - div, textarea, label, input, form, span, ul, li, ol, a, button, h1, h2, h3, h4, h5, p, img { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -580,6 +552,9 @@ button.save.has-count .count::before { .icon.back.blue { background-position: -420px -20px;} .icon.forward.blue { background-position: -440px -20px;} +.icon.full-screen { background-position: -620px -20px;} +.active .icon.full-screen { background-position: -640px -20px;} + button[disabled] .icon.alert { background-position: 0 -40px;} button[disabled] .icon.add-point { background-position: -20px -40px;} button[disabled] .icon.add-line { background-position: -40px -40px;} @@ -1765,6 +1740,27 @@ img.wiki-image { background: rgba(0,0,0,.8); } +/* Fullscreen button */ +div.full-screen { + float: right; + width: 40px; + margin-right: 10px; +} + +div.full-screen .tooltip { + min-width: 160px; +} + +div.full-screen > button, div.full-screen > button.active { + width: 40px; + height: 40px; + background: transparent; +} + +div.full-screen > button:hover { + background-color: rgba(0, 0, 0, .8); +} + /* Map Controls */ .map-controls { diff --git a/dist/img/fullscreen_exit.svg b/dist/img/fullscreen_exit.svg deleted file mode 100644 index 8608ceb52..000000000 --- a/dist/img/fullscreen_exit.svg +++ /dev/null @@ -1,64 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/dist/img/fullscreen_request.svg b/dist/img/fullscreen_request.svg deleted file mode 100644 index fbdc9874c..000000000 --- a/dist/img/fullscreen_request.svg +++ /dev/null @@ -1,64 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/dist/img/sprite.svg b/dist/img/sprite.svg index b47a50a64..7aec0cc11 100644 --- a/dist/img/sprite.svg +++ b/dist/img/sprite.svg @@ -13,7 +13,7 @@ width="800" height="560" id="svg12393" - inkscape:version="0.48.5 r10040" + inkscape:version="0.48.4 r9939" sodipodi:docname="sprite.svg"> + + + + + + + + + + + + + + + + + + + + + + diff --git a/dist/locales/en.json b/dist/locales/en.json index 6eefaada4..d237cf54a 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -430,9 +430,7 @@ "help": "Another user changed some of the same map features you changed.\nClick on each item below for more details about the conflict, and choose whether to keep\nyour changes or the other user's changes.\n" } }, - "full_screen": { - "tooltip": "Toggle Full Screen" - }, + "full_screen": "Toggle Fullscreen", "merge_remote_changes": { "conflict": { "deleted": "This object has been deleted by {user}.", diff --git a/js/id/ui.js b/js/id/ui.js index 4d4f80780..1fb7d0a2a 100644 --- a/js/id/ui.js +++ b/js/id/ui.js @@ -60,14 +60,14 @@ iD.ui = function(context) { .attr('class', 'button-wrap col1') .call(iD.ui.Save(context)); - bar.append('div') - .attr('class', 'spinner') - .call(iD.ui.Spinner(context)); - bar.append('div') .attr('class', 'full-screen') .call(iD.ui.FullScreen(context)); + bar.append('div') + .attr('class', 'spinner') + .call(iD.ui.Spinner(context)); + var controls = bar.append('div') .attr('class', 'map-controls'); diff --git a/js/id/ui/full_screen.js b/js/id/ui/full_screen.js index e2fec1347..1e00f63b2 100644 --- a/js/id/ui/full_screen.js +++ b/js/id/ui/full_screen.js @@ -26,8 +26,8 @@ iD.ui.FullScreen = function(context) { } function isFullScreen() { - return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement - || document.msFullscreenElement; + return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || + document.msFullscreenElement; } function is_supported() { @@ -53,10 +53,12 @@ iD.ui.FullScreen = function(context) { .placement('left'); button = selection.append('button') - .attr('class', 'full-screen') - .attr('title', t('full_screen.tooltip')) + .attr('title', t('full_screen')) .attr('tabindex', -1) .on('click', fullScreen) .call(tooltip); + + button.append('span') + .attr('class', 'icon full-screen'); }; }; From 209b324bc2c3b7df4680e3d0db6ba03e951afd04 Mon Sep 17 00:00:00 2001 From: M1dgard Date: Sat, 5 Sep 2015 10:28:06 +0200 Subject: [PATCH 07/11] Fix "terms" translations (closes #2756) Make them lowercase and split them on any combination of commas and whitespace. --- js/id/presets/preset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/id/presets/preset.js b/js/id/presets/preset.js index 32411eaab..b33d76604 100644 --- a/js/id/presets/preset.js +++ b/js/id/presets/preset.js @@ -46,7 +46,7 @@ iD.presets.Preset = function(id, preset, fields) { }; preset.terms = function() { - return preset.t('terms', {'default': ''}).split(','); + return preset.t('terms', {'default': ''}).toLowerCase().split(/\s*,+\s*/); }; preset.isFallback = function() { From dd32ec39b3fabd2b9325370303e80513627a892e Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Sat, 5 Sep 2015 15:35:43 +0200 Subject: [PATCH 08/11] Correct API version in osmChange and changeset XML The version attribute of the osmChange and changeset XML should read `0.6` (the version of the OSM API the data is created for), even though the attribute is actually ignored by the OSM API (see http://wiki.openstreetmap.org/wiki/OsmChange). --- js/id/core/connection.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/id/core/connection.js b/js/id/core/connection.js index 6944ed73c..985d9e019 100644 --- a/js/id/core/connection.js +++ b/js/id/core/connection.js @@ -210,7 +210,7 @@ iD.Connection = function(useHttps) { tag: _.map(tags, function(value, key) { return { '@k': key, '@v': value }; }), - '@version': 0.3, + '@version': 0.6, '@generator': 'iD' } } @@ -240,7 +240,7 @@ iD.Connection = function(useHttps) { return { osmChange: { - '@version': 0.3, + '@version': 0.6, '@generator': 'iD', 'create': nest(changes.created.map(rep), ['node', 'way', 'relation']), 'modify': nest(changes.modified.map(rep), ['node', 'way', 'relation']), From d7d3bb4cf8d49cdb018454aa04c4aceb5277137a Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Sat, 5 Sep 2015 16:50:13 +0200 Subject: [PATCH 09/11] update tests to reflect changes in dd32ec39 (The version attribute of the osmChange XML should read `0.6`) --- test/spec/core/connection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/core/connection.js b/test/spec/core/connection.js index 9b3eded0d..11ae4470e 100644 --- a/test/spec/core/connection.js +++ b/test/spec/core/connection.js @@ -195,7 +195,7 @@ describe('iD.Connection', function () { expect(jxon).to.eql({ osmChange: { - '@version': 0.3, + '@version': 0.6, '@generator': 'iD', 'create': {}, 'modify': {}, From 594b4c19cfa83b701fe9b45124ade35d57ee47f6 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 5 Sep 2015 23:09:07 -0400 Subject: [PATCH 10/11] Disable fullscreen button, add keyboard shortcuts --- data/core.yaml | 1 + dist/locales/en.json | 2 +- js/id/ui/full_screen.js | 39 ++++++++++++++++++++++++--------------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/data/core.yaml b/data/core.yaml index 627e62a2c..8297146be 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -401,6 +401,7 @@ en: in: Zoom In out: Zoom Out cannot_zoom: "Cannot zoom out further in current mode." + full_screen: Toggle Full Screen gpx: local_layer: "Local GPX file" drag_drop: "Drag and drop a .gpx file on the page, or click the button to the right to browse" diff --git a/dist/locales/en.json b/dist/locales/en.json index 96f58b475..2c59ab543 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -430,7 +430,6 @@ "help": "Another user changed some of the same map features you changed.\nClick on each item below for more details about the conflict, and choose whether to keep\nyour changes or the other user's changes.\n" } }, - "full_screen": "Toggle Fullscreen", "merge_remote_changes": { "conflict": { "deleted": "This object has been deleted by {user}.", @@ -485,6 +484,7 @@ "out": "Zoom Out" }, "cannot_zoom": "Cannot zoom out further in current mode.", + "full_screen": "Toggle Full Screen", "gpx": { "local_layer": "Local GPX file", "drag_drop": "Drag and drop a .gpx file on the page, or click the button to the right to browse", diff --git a/js/id/ui/full_screen.js b/js/id/ui/full_screen.js index 1e00f63b2..e16569221 100644 --- a/js/id/ui/full_screen.js +++ b/js/id/ui/full_screen.js @@ -1,5 +1,7 @@ iD.ui.FullScreen = function(context) { - var element = context.container().node(), button; + var element = context.container().node(), + keybinding = d3.keybinding('full-screen'); + // button; function getFullScreenFn() { if (element.requestFullscreen) { @@ -30,35 +32,42 @@ iD.ui.FullScreen = function(context) { document.msFullscreenElement; } - function is_supported() { + function isSupported() { return !!getFullScreenFn(); } function fullScreen() { d3.event.preventDefault(); if (!isFullScreen()) { - button.classed('active', true); + // button.classed('active', true); getFullScreenFn().apply(element); } else { - button.classed('active', false); + // button.classed('active', false); getExitFullScreenFn().apply(document); } } - return function(selection) { - if (!is_supported()) + return function() { // selection) { + if (!isSupported()) return; - var tooltip = bootstrap.tooltip() - .placement('left'); + // var tooltip = bootstrap.tooltip() + // .placement('left'); - button = selection.append('button') - .attr('title', t('full_screen')) - .attr('tabindex', -1) - .on('click', fullScreen) - .call(tooltip); + // button = selection.append('button') + // .attr('title', t('full_screen')) + // .attr('tabindex', -1) + // .on('click', fullScreen) + // .call(tooltip); - button.append('span') - .attr('class', 'icon full-screen'); + // button.append('span') + // .attr('class', 'icon full-screen'); + + keybinding + .on(iD.ui.cmd('f11'), fullScreen) + .on(iD.ui.cmd('⌘⇧F'), fullScreen); + + d3.select(document) + .call(keybinding); }; }; From 522e593f112d3c628604a54a2d0ca0bae11dc5c3 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sun, 6 Sep 2015 22:46:55 -0400 Subject: [PATCH 11/11] Improvements to access field (closes #2763) --- data/presets.yaml | 6 +++--- data/presets/fields.json | 6 +++--- data/presets/fields/access.json | 4 ++-- data/presets/fields/access_simple.json | 2 +- dist/locales/en.json | 6 +++--- js/id/ui/preset/access.js | 18 ++++++++---------- test/spec/ui/preset/access.js | 4 ++-- 7 files changed, 22 insertions(+), 24 deletions(-) diff --git a/data/presets.yaml b/data/presets.yaml index 8273dfada..dccf117f5 100644 --- a/data/presets.yaml +++ b/data/presets.yaml @@ -62,16 +62,16 @@ en: # access=yes title: Allowed # access field placeholder - placeholder: Unknown + placeholder: Not Specified types: - access: General + access: All bicycle: Bicycles foot: Foot horse: Horses motor_vehicle: Motor Vehicles access_simple: # 'access=*' - label: Access + label: Allowed Access # access_simple field placeholder placeholder: 'yes' access_toilets: diff --git a/data/presets/fields.json b/data/presets/fields.json index 386280ff1..a18ed9bc3 100644 --- a/data/presets/fields.json +++ b/data/presets/fields.json @@ -12,10 +12,10 @@ }, "type": "access", "label": "Allowed Access", - "placeholder": "Unknown", + "placeholder": "Not Specified", "strings": { "types": { - "access": "General", + "access": "All", "foot": "Foot", "motor_vehicle": "Motor Vehicles", "bicycle": "Bicycles", @@ -56,7 +56,7 @@ "access_simple": { "key": "access", "type": "combo", - "label": "Access", + "label": "Allowed Access", "placeholder": "yes", "options": [ "permissive", diff --git a/data/presets/fields/access.json b/data/presets/fields/access.json index 9bf5e0348..8615abfa7 100644 --- a/data/presets/fields/access.json +++ b/data/presets/fields/access.json @@ -3,10 +3,10 @@ "reference": {"key": "access"}, "type": "access", "label": "Allowed Access", - "placeholder": "Unknown", + "placeholder": "Not Specified", "strings": { "types": { - "access": "General", + "access": "All", "foot": "Foot", "motor_vehicle": "Motor Vehicles", "bicycle": "Bicycles", diff --git a/data/presets/fields/access_simple.json b/data/presets/fields/access_simple.json index e2bc42e9e..66a25d4a9 100644 --- a/data/presets/fields/access_simple.json +++ b/data/presets/fields/access_simple.json @@ -1,7 +1,7 @@ { "key": "access", "type": "combo", - "label": "Access", + "label": "Allowed Access", "placeholder": "yes", "options": ["permissive", "private", "customers", "no"] } diff --git a/dist/locales/en.json b/dist/locales/en.json index 2c59ab543..7fdbb96b0 100644 --- a/dist/locales/en.json +++ b/dist/locales/en.json @@ -593,9 +593,9 @@ "fields": { "access": { "label": "Allowed Access", - "placeholder": "Unknown", + "placeholder": "Not Specified", "types": { - "access": "General", + "access": "All", "foot": "Foot", "motor_vehicle": "Motor Vehicles", "bicycle": "Bicycles", @@ -633,7 +633,7 @@ } }, "access_simple": { - "label": "Access", + "label": "Allowed Access", "placeholder": "yes" }, "access_toilets": { diff --git a/js/id/ui/preset/access.js b/js/id/ui/preset/access.js index 13dde11d0..f3d162ac5 100644 --- a/js/id/ui/preset/access.js +++ b/js/id/ui/preset/access.js @@ -54,10 +54,10 @@ iD.ui.preset.access = function(field) { if (type !== 'access') { options.unshift('yes'); options.push('designated'); - } - if (type === 'bicycle') { - options.push('dismount'); + if (type === 'bicycle') { + options.push('dismount'); + } } return options.map(function(option) { @@ -178,14 +178,12 @@ iD.ui.preset.access = function(field) { return tags.access ? tags.access : field.placeholder(); }); - items.selectAll('#preset-input-access-access') - .attr('placeholder', 'yes'); + // items.selectAll('#preset-input-access-access') + // .attr('placeholder', 'yes'); - _.forEach(placeholders[tags.highway], function(value, key) { - items.selectAll('#preset-input-access-' + key) - .attr('placeholder', function() { - return (tags.access && (value === 'yes' || value === 'designated')) ? tags.access : value; - }); + _.forEach(placeholders[tags.highway], function(v, k) { + items.selectAll('#preset-input-access-' + k) + .attr('placeholder', function() { return (tags.access || v); }); }); }; diff --git a/test/spec/ui/preset/access.js b/test/spec/ui/preset/access.js index 3533ce017..34a2fb737 100644 --- a/test/spec/ui/preset/access.js +++ b/test/spec/ui/preset/access.js @@ -94,12 +94,12 @@ describe('iD.ui.preset.access', function() { expect(selection.selectAll('#preset-input-access-bicycle').attr('placeholder')).to.equal('permissive'); }); - it('does not override a "no" placeholder with more specific access tag (#2213)', function() { + it('overrides a "no" placeholder with more specific access tag (#2763)', function() { var access = iD.ui.preset.access(field); selection.call(access); access.tags({highway: 'cycleway', access: 'destination'}); - expect(selection.selectAll('#preset-input-access-motor_vehicle').attr('placeholder')).to.equal('no'); + expect(selection.selectAll('#preset-input-access-motor_vehicle').attr('placeholder')).to.equal('destination'); }); });