mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-01 04:31:36 +02:00
Added tooltip, cross browser requestFullScreen call and key binding
This commit is contained in:
Vendored
+2
-1
@@ -431,7 +431,8 @@
|
||||
}
|
||||
},
|
||||
"full_screen": {
|
||||
"title": "Full Screen"
|
||||
"title": "Full Screen",
|
||||
"tooltip": "Go to Full Screen mode"
|
||||
},
|
||||
"merge_remote_changes": {
|
||||
"conflict": {
|
||||
|
||||
+34
-15
@@ -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);
|
||||
});
|
||||
});*/
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user