Die Earth Engine hat
nicht kommerzielle Kontingentstufen eingeführt, um gemeinsam genutzte Rechenressourcen zu schützen und eine zuverlässige Leistung für alle sicherzustellen. Für nicht kommerzielle Projekte wird standardmäßig die Community-Stufe verwendet. Sie können die Stufe eines Projekts aber jederzeit ändern.
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
ui.root.setKeyHandler
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Legt einen Keydown-Event-Handler für das Stamm-Panel mit einem nicht vordefinierten Schlüssel fest. Der Handler wird nur einmal ausgelöst, wenn ein Nutzer den gebundenen Tastaturbefehl drückt. Derselbe Schlüssel wird an den zuletzt dafür festgelegten Handler gebunden.
| Nutzung | Ausgabe |
|---|
ui.root.setKeyHandler(keyCode, handler, description) | |
| Argument | Typ | Details |
|---|
keyCode | List[ui.Key]|ui.Key | Ein Tastencode oder ein Array von Tastencodes. Beispiel: ui.Key.A oder [ui.Key.SHIFT, ui.Key.A]. |
handler | Funktion | Der Handler für den Tastaturbefehl. |
description | String, optional | Eine kurze Beschreibung, die diesen Tastaturbefehl erklärt. Die Beschreibung ist im Menü „Shortcuts“ sichtbar. |
Beispiele
Code-Editor (JavaScript)
// Replace the default UI widgets with a few custom widgets.
// Print "Shift A" to the console when Shift+A is pressed.
ui.root.setKeyHandler(
[ui.Key.SHIFT, ui.Key.A],
function() {
print('Shift A');
},
'A simple print'
);
// Create a solid black image.
var blackImage = ee.Image(1).visualize({palette: ['black']});
// Create a Layer object so we can easily manipulate its properties.
var blackLayer = ui.Map.Layer(blackImage, {}, 'Black Overlay', true);
// Add the layer to the Map.
Map.layers().add(blackLayer);
// Pressing the "b" key will toggle the layer on and off.
ui.root.setKeyHandler(ui.Key.B, function() {
// Get the current visibility state.
var isShown = blackLayer.getShown();
// Set the visibility to the opposite of the current state.
blackLayer.setShown(!isShown);
// Print the status to the console.
print('Black layer visible: ' + !isShown);
}, 'Toggle black layer');
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2026-04-16 (UTC).
[null,null,["Zuletzt aktualisiert: 2026-04-16 (UTC)."],[],["The `setKeyHandler` function binds a key command to a handler function on the root panel. It accepts a key code (or array of codes), a handler function, and an optional description. When the bound key is pressed, the handler is executed once. Only the most recently assigned handler for a specific key will be triggered. Key codes can be individual (e.g., `ui.Key.A`) or combined (e.g., `[ui.Key.SHIFT, ui.Key.A]`). The description is used in the Shortcuts Menu.\n"]]