Earth Engine은 공유 컴퓨팅 리소스를 보호하고 모든 사용자에게 안정적인 성능을 보장하기 위해
비상업적 할당량 등급을 도입했습니다. 비상업적 프로젝트는 기본적으로 커뮤니티 등급을 사용하지만 언제든지 프로젝트의 등급을 변경할 수 있습니다.
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
ui.root.setKeyHandler
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
미리 정의되지 않은 키가 있는 루트 패널에 keydown 이벤트 핸들러를 설정합니다. 사용자가 바인딩된 키 명령어를 누르면 핸들러가 한 번만 실행됩니다. 동일한 키가 설정된 최신 핸들러에 바인딩됩니다.
| 사용 | 반환 값 |
|---|
ui.root.setKeyHandler(keyCode, handler, description) | |
| 인수 | 유형 | 세부정보 |
|---|
keyCode | List[ui.Key]|ui.Key | 키 코드 또는 키 코드 배열입니다. 예를 들어 ui.Key.A 또는 [ui.Key.SHIFT, ui.Key.A]입니다. |
handler | 함수 | 키 명령어의 핸들러입니다. |
description | 문자열, 선택사항 | 이 키 명령어를 설명하는 간단한 설명입니다. 설명은 단축키 메뉴에 표시됩니다. |
예
코드 편집기 (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 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2026-04-16(UTC)
[null,null,["최종 업데이트: 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"]]