Open leleshuo opened 1 year ago
emitTouchData(type, touches, fingerIds) { const data = new DataView(new ArrayBuffer(2 + 7 touches.length)); data.setUint8(0, type); data.setUint8(1, touches.length); let byte = 2; for (const touch of touches) { const x = touch.clientX - this.offsetLeft; const y = touch.clientY - this.offsetTop; const coord = this.normalize(x, y); data.setUint16(byte, coord.x, true); byte += 2; data.setUint16(byte, coord.y, true); byte += 2; data.setUint8(byte, fingerIds[touch.identifier], true); byte += 1; data.setUint8(byte, 255 touch.force, true); // force is between 0.0 and 1.0 so quantize into byte. byte += 1; data.setUint8(byte, 1, true); byte += 1; } this.dc.send(data); }
在ue5.2中 ,修改上面函数可以多点触控
在peer-stream.js中修改之后,5.0.3项目可以实现多指生效吗?
emitTouchData(type, touches, fingerIds) { const data = new DataView(new ArrayBuffer(2 + 7 touches.length)); data.setUint8(0, type); data.setUint8(1, touches.length); let byte = 2; for (const touch of touches) { const x = touch.clientX - this.offsetLeft; const y = touch.clientY - this.offsetTop; const coord = this.normalize(x, y); data.setUint16(byte, coord.x, true); byte += 2; data.setUint16(byte, coord.y, true); byte += 2; data.setUint8(byte, fingerIds[touch.identifier], true); byte += 1; data.setUint8(byte, 255 touch.force, true); // force is between 0.0 and 1.0 so quantize into byte. byte += 1; data.setUint8(byte, 1, true); byte += 1; } this.dc.send(data); }
在ue5.2中 ,修改上面函数可以多点触控