mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-25 01:20:34 +00:00
made formatting changes
This commit is contained in:
parent
9487b5367d
commit
fe1889653e
@ -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;
|
||||||
}
|
}
|
||||||
@ -1277,27 +1276,22 @@ public final class PopupVideoPlayer extends Service {
|
|||||||
int scaledTouchSlop = ViewConfiguration.get(PopupVideoPlayer.this).getScaledTouchSlop();
|
int scaledTouchSlop = ViewConfiguration.get(PopupVideoPlayer.this).getScaledTouchSlop();
|
||||||
|
|
||||||
if(firstPointerMoveX > scaledTouchSlop ||firstPointerMoveY > scaledTouchSlop ||
|
if(firstPointerMoveX > scaledTouchSlop ||firstPointerMoveY > scaledTouchSlop ||
|
||||||
secPointerMoveX > scaledTouchSlop || secPointerMoveY > scaledTouchSlop){
|
secPointerMoveX > scaledTouchSlop || secPointerMoveY > scaledTouchSlop) {
|
||||||
|
|
||||||
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 += (popupWidth - newWidth)/2;
|
||||||
popupLayoutParams.x -= (newWidth - popupWidth)/2;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
popupLayoutParams.x += (popupWidth - newWidth)/2;
|
|
||||||
}
|
|
||||||
|
|
||||||
initPointerDistance = currentPointerDistance;
|
initPointerDistance = currentPointerDistance;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user