Files
zhengte.doc/public/docs/hotspot-events.md
yinsx 24cebd2179 1
2026-01-05 17:41:00 +08:00

739 B

热点与事件

渲染热点

const hotspots = [
  {
    id: 'engine',
    position: [0.8, 0.6, -0.2],
    icon: 'info',
    label: '发动机舱',
    event: 'show-engine',
    payload: { part: 'engine' },
  },
  {
    id: 'door',
    position: [1.1, 0.9, 0.4],
    icon: 'action',
    label: '开启车门',
    event: 'toggle-door',
    payload: { side: 'left' },
  },
]

sdk.hotspot.render(hotspots)

订阅事件

sdk.hotspot.on('click', ({ id, payload }) => {
  // 根据 id/payload 触发业务逻辑
})

sdk.hotspot.on('hover', ({ id, hovering }) => {
  // hover 高亮或提示
})

事件命名建议

  • hotspot:clickhotspot:hoverhotspot:focus
  • hotspot:rendered(所有热点就绪)