index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. var sceneReadyBehavior = require('../../behavior-scene/scene-ready');
  2. Page({
  3. behaviors:[sceneReadyBehavior],
  4. data: {
  5. messageData: {
  6. moveX: 0,
  7. moveZ: 0,
  8. },
  9. speedX: '0.00',
  10. speedZ: '0.00',
  11. posX: '0.00',
  12. posZ: '0.00',
  13. showXRFrame: true,
  14. },
  15. tapPlusX() {
  16. this.setData({
  17. messageData: {
  18. moveX: this.data.messageData.moveX + 1,
  19. moveZ: this.data.messageData.moveZ
  20. }
  21. });
  22. },
  23. tapSubX() {
  24. this.setData({
  25. messageData: {
  26. moveX: this.data.messageData.moveX - 1,
  27. moveZ: this.data.messageData.moveZ
  28. }
  29. });
  30. },
  31. tapPlusZ() {
  32. this.setData({
  33. messageData: {
  34. moveX: this.data.messageData.moveX,
  35. moveZ: this.data.messageData.moveZ + 1,
  36. }
  37. });
  38. },
  39. tapSubZ() {
  40. this.setData({
  41. messageData: {
  42. moveX: this.data.messageData.moveX,
  43. moveZ: this.data.messageData.moveZ - 1,
  44. }
  45. });
  46. },
  47. tapClose() {
  48. this.setData({
  49. showXRFrame: !this.data.showXRFrame
  50. })
  51. },
  52. handleInfoListener(cur) {
  53. const detail = cur.detail;
  54. this.setData({
  55. speedX: detail.speedX,
  56. speedZ: detail.speedZ,
  57. posX: detail.posX,
  58. posZ: detail.posZ
  59. });
  60. }
  61. });