made formatting changes

This commit is contained in:
Harshal Lele 2020-03-08 12:10:06 +05:30 committed by Stypox
parent 9487b5367d
commit fe1889653e
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23

View file

@ -1217,9 +1217,8 @@ public final class PopupVideoPlayer extends Service {
initSecPointerX = event.getX(1); initSecPointerX = event.getX(1);
initSecPointerY = event.getY(1); initSecPointerY = event.getY(1);
//record distance between fingers //record distance between fingers
float xDiff = event.getX(0) - event.getX(1); initPointerDistance = Math.hypot(event.getX(0) - event.getX(1),
float yDiff = event.getY(0) - event.getY(1); event.getY(0) - event.getY(1));
initPointerDistance = Math.sqrt(xDiff * xDiff + yDiff * yDiff);
isResizing = true; isResizing = true;
} }
@ -1282,22 +1281,17 @@ public final class PopupVideoPlayer extends Service {
double newWidth = popupWidth; double newWidth = popupWidth;
//calculate current distance between the pointers //calculate current distance between the pointers
float currentXDiff = event.getX(0) - event.getX(1); double currentPointerDistance = Math.hypot(event.getX(0) - event.getX(1),
float currentYDiff = event.getY(0) - event.getY(1); event.getY(0) - event.getY(1));
double currentPointerDistance = Math.sqrt(currentXDiff * currentXDiff + currentYDiff * currentYDiff);
//scale popup width //scale popup width
double scale = 1 + (currentPointerDistance - initPointerDistance)/ initPointerDistance; double scale = currentPointerDistance / initPointerDistance;
newWidth = (popupWidth * scale); newWidth = (popupWidth * scale);
//change co-ordinates of popup so the center stays at the same position //change co-ordinates of popup so the center stays at the same position
if(currentPointerDistance > initPointerDistance){
popupLayoutParams.x -= (newWidth - popupWidth)/2;
}
else{
popupLayoutParams.x += (popupWidth - newWidth)/2; popupLayoutParams.x += (popupWidth - newWidth)/2;
}
initPointerDistance = currentPointerDistance; initPointerDistance = currentPointerDistance;