1.4 KiB
order, title, type, label
| order | title | type | label |
|---|---|---|---|
| 0 | Interaction Overview | Interaction | Interact |
Galacean provides a basic input system. Based on cross-end and cross-platform features, the interaction system is well compatible with both PC and mobile ends. The current interaction system can accept the following inputs:
Initialization
When initializing the engine, you can customize the listening sources for touch, keyboard, and wheel.
// 将触控事件的监听源设置为 document
const engine = await WebGLEngine.create({
canvas,
input: {
pointerTarget: document,
},
});
⚠️ Do not set the listening source of touch to
window, becausewindowcannot receivePointerLevelevents, which will cause touch information confusion.
⚠️ If you set the listening source of the keyboard to a certain
HtmlElement, you need to set itstabIndexso that it can be focused. For example, you can callcanvas.tabIndex = canvas.tabIndex;once.
Framebuffer Picking
If the engine's touch callback cannot meet your needs, you can try using framebuffer picking