index.js 640 B

1234567891011121314151617181920212223242526
  1. Component({
  2. behaviors: [require('../../common/share-behavior').default],
  3. properties: {
  4. a: Number,
  5. },
  6. data: {
  7. loaded: false
  8. },
  9. lifetimes: {},
  10. methods: {
  11. handleReady({detail}) {
  12. const xrScene = this.scene = detail.value;
  13. console.log('xr-scene', xrScene);
  14. this.scene.event.add('touchstart', this.handleShare.bind(this));
  15. },
  16. handleShare(event) {
  17. const {clientX, clientY} = event.touches[0];
  18. const {frameWidth: width, frameHeight: height} = this.scene;
  19. if (clientY / height > 0.7 && clientX / width > 0.7) {
  20. this.scene.share.captureToFriends();
  21. }
  22. }
  23. }
  24. })