mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 13:18:15 +02:00
Added button to switch to full screen mode
This commit is contained in:
@@ -29,7 +29,6 @@ body {
|
||||
.id-container {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
min-width: 768px;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+3
@@ -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}.",
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user