Added button to switch to full screen mode

This commit is contained in:
Paul Annekov
2015-07-10 23:44:03 +03:00
parent ee00564a6c
commit 24802c9399
5 changed files with 68 additions and 1 deletions
-1
View File
@@ -29,7 +29,6 @@ body {
.id-container {
height: 100%;
width: 100%;
position: fixed;
min-width: 768px;
}
+3
View File
@@ -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}.",
+1
View File
@@ -99,6 +99,7 @@
<script src='js/id/ui/flash.js'></script>
<script src='js/id/ui/feature_info.js'></script>
<script src='js/id/ui/save.js'></script>
<script src='js/id/ui/full_screen.js'></script>
<script src='js/id/ui/scale.js'></script>
<script src='js/id/ui/splash.js'></script>
<script src='js/id/ui/spinner.js'></script>
+4
View File
@@ -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));
+60
View File
@@ -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);
});
};
};