2

I am testing a project on my Surface Pro 4 and I am using the Touch interface in javascript. According to MDN, the rotationAngle and force properties should return [0 - 90] and [0.0 - 1.0] respectively.

But no matter how I touch the display, I get fixed values for either of them. In Chrome (81) it is always 0 and 0.5. In Firefox (76), 0 and 0 are returned.

The code is simple:

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);

});

Now, about the force property, MDN specifies that if the value is unknown for some reason (e.g. the device doesn't support it), 0.0 is returned. But nothing is mentioned about a constant 0.5 for this property or 0 for the rotationAngle.

Am I missing something? Or does the Surface Pro 4 indeed not support these values and I can not do anything about it?

Mahm00d
  • 3,881
  • 8
  • 44
  • 83

1 Answers1

1

The touch.force property is not supported on Surface devices. This is because the Surface line of devices does not have a pressure sensor, which is required to measure the force of a touch. The touch.force property can only be used on devices that have a pressure sensor, such as the iPhone, iPad, and some Android devices.

If you are trying to use the touch.force property on a Surface device, you will need to use a different method to measure the force of a touch, such as using a stylus or a pressure-sensitive keyboard.

I've tried on some big-screen devices with Windows system installed, still got the same result.

Jaytalent
  • 41
  • 4