index.wxml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <xr-demo-viewer
  2. title="第一人称控制器"
  3. intro="左下角的虚拟摇杆区域进行操纵位移,右下角对摄像头进行位置重置,其它区域为影响旋转视角的区域"
  4. hint="要求基础库 v2.30.3 及以上"
  5. showBackBtn="{{true}}"
  6. >
  7. <xr-template-control
  8. disable-scroll
  9. id="main-frame"
  10. width="{{renderWidth}}"
  11. height="{{renderHeight}}"
  12. reset="{{reset}}"
  13. transferData="{{transferData}}"
  14. style="width:{{width}}px; height:{{height}}px; top:{{top}}px; left:{{left}}px; display:block;"
  15. bindinfoListener="handleInfoListener"
  16. />
  17. <!-- 旋转区域 -->
  18. <view class="rt-area"
  19. style="height: {{height}}px"
  20. catchtouchstart='touchRotateStart'
  21. catchtouchmove='touchRotateMove'
  22. bindtouchend='touchRotateEnd'>
  23. </view>
  24. <!-- 摇杆区域 -->
  25. <view class="mv-area"
  26. style="top: {{height - 100}}px;"
  27. catchtouchstart='touchStart'
  28. catchtouchmove='touchMove'
  29. bindtouchend='touchEnd'>
  30. <image class="mv-bg" src="/assets/image/background.png" />
  31. <image class="mv-handle" style="left:{{hLeft}}px; top:{{hTop}}px;" src="/assets/image/handle.png" />
  32. </view>
  33. <view class="reset-btn" style="top: {{height}}px;">
  34. <button bindtap="reset">位置重置</button>
  35. </view>
  36. </xr-demo-viewer>