我正在我的 Surface Pro 4 上测试一个项目,我在 javascript 中使用Touch 界面。根据 MDN,rotationAngle
andforce
属性应该分别返回 [0 - 90] 和 [0.0 - 1.0]。
但无论我如何触摸显示屏,我都会得到它们中的任何一个的固定值。在 Chrome (81) 中,它始终是0和0.5。在 Firefox (76) 中,返回0和0。
代码很简单:
element.addEventListener('touchstart', function(evt) {
// Prevent the mouse click
evt.preventDefault();
//-- Log the touch information
var touch = evt.changedTouches.item(0);
console.log(touch.radiusX);
console.log(touch.radiusY);
console.log(touch.rotationAngle);
console.log(touch.force);
});
现在,关于该force
属性,MDN 指定如果由于某种原因该值未知(例如设备不支持它),则返回 0.0。但是没有提到这个属性的常数 0.5 或rotationAngle
.
我错过了什么吗?还是 Surface Pro 4 确实不支持这些值而我对此无能为力?