mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Disable fullscreen button, add keyboard shortcuts
This commit is contained in:
@@ -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"
|
||||
|
||||
2
dist/locales/en.json
vendored
2
dist/locales/en.json
vendored
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user