1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

note on touch

This commit is contained in:
Sander Moolin 2021-03-25 10:12:11 -04:00
parent 0eb03737de
commit c325d47617

View File

@ -138,10 +138,11 @@ export default {
this.pointer.y = - ((evt.y - canvasTop) / this.three.size.height) * 2 + 1;
},
onTouchMove(evt) {
const touch = evt.touches[0]
const { top: canvasTop, left: canvasLeft } = this.three.mouse_move_element.getBoundingClientRect()
this.pointer.x = ((touch.x - canvasLeft) / this.three.size.width) * 2 - 1
this.pointer.y = -((touch.y - canvasTop) / this.three.size.height) * 2 + 1
console.log('TODO: handle touch')
// const touch = evt.touches[0]
// const { top: canvasTop, left: canvasLeft } = this.three.mouse_move_element.getBoundingClientRect()
// this.pointer.x = ((touch.x - canvasLeft) / this.three.size.width) * 2 - 1
// this.pointer.y = -((touch.y - canvasTop) / this.three.size.height) * 2 + 1
}
},
render() {