אנחנו משיקים ב-Earth Engine
רמות מכסה לשימוש לא מסחרי כדי להגן על משאבי מחשוב משותפים ולהבטיח ביצועים אמינים לכולם. כל הפרויקטים הלא מסחריים יצטרכו לבחור רמת מכסת שימוש עד
27 באפריל 2026, אחרת הם ישתמשו ברמת הקהילה כברירת מחדל. המיכסות לפי רמה ייכנסו לתוקף בכל הפרויקטים (ללא קשר לתאריך הבחירה של הרמה) ב-
27 באפריל 2026.
מידע נוסף
ui.root.setKeyHandler
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מגדיר גורם מטפל באירועים של אירוע keydown לחלונית הבסיס עם מקש שלא הוגדר מראש. ה-handler מופעל רק פעם אחת כשמשתמש לוחץ על פקודת המקשים שמוגדרת. אותו מפתח יקשר ל-handler העדכני ביותר שהוגדר לו.
| שימוש | החזרות |
|---|
ui.root.setKeyHandler(keyCode, handler, description) | |
| ארגומנט | סוג | פרטים |
|---|
keyCode | List[ui.Key]|ui.Key | קוד מקש או מערך של קודי מקשים. לדוגמה, ui.Key.A או [ui.Key.SHIFT, ui.Key.A]. |
handler | פונקציה | ה-handler של פקודת המפתח. |
description | מחרוזת, אופציונלי | תיאור קצר שמסביר את פקודת המקשים הזו. התיאור יוצג בתפריט קיצורי הדרך. |
דוגמאות
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');
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2026-03-27 (שעון UTC).
[null,null,["עדכון אחרון: 2026-03-27 (שעון 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"]]