I want to operate on the mobile phone: when the positions of both fingers change, turn on the zoom operation; Turn on the rotation operation when the position of one finger remains unchanged and the other finger changes.
Now the effect can be achieved in the browser of iPhone x, but not in Android phones; My research found that the points of two fingers in iPhone x can change at the same time, but in Android phones, the position of one finger changes and then the position of the other finger changes. I’m very confused about this.
Here is my sample code:
handler.setInputAction(
function (mouseMovement) {
var distance=mouseMovement.distance;
var angleAndHeight=mouseMovement.angleAndHeight;
//console.log("_positions:"+JSON.stringify(handler._positions))
//console.log("_previousPositions:"+JSON.stringify(handler._previousPositions))
var positions=handler._positions;
var previousPositions=handler._previousPositions;
var position1 = positions.values[0];
var position2 = positions.values[1];
var previousPosition1 = previousPositions.values[0];
var previousPosition2 = previousPositions.values[1];
console.log("position1:"+isObjectValueEqual(position1,previousPosition1));
console.log("position2:"+isObjectValueEqual(position2,previousPosition2));
console.log("position1:"+JSON.stringify(position1)+"position2:"+JSON.stringify(position2)+"previousPosition1:"+JSON.stringify(previousPosition1)+"previousPosition2:"+JSON.stringify(previousPosition2))
if(isObjectValueEqual(position1,previousPosition1)||isObjectValueEqual(position2,previousPosition2))
{
controller.enableZoom = false;
controller.enableTilt = true;
}
else{
controller.enableZoom = true;
controller.enableTilt = false;
}
},
Cesium.ScreenSpaceEventType.PINCH_MOVE
);```