mirror of
https://github.com/thelounge/thelounge
synced 2025-03-02 14:17:13 +00:00
Restrict image viewer bounds while moving
This commit is contained in:
parent
55e5c69958
commit
dbfa5c5746
1 changed files with 5 additions and 10 deletions
|
@ -197,7 +197,6 @@ export default {
|
|||
const touchMove = (moveEvent) => {
|
||||
touch = this.reduceTouches(moveEvent.touches);
|
||||
|
||||
// TODO: There's bugs with multi finger interactions, needs more testing
|
||||
if (currentTouches.length !== moveEvent.touches.length) {
|
||||
currentTransform.x = touch.x;
|
||||
currentTransform.y = touch.y;
|
||||
|
@ -221,16 +220,10 @@ export default {
|
|||
startTransform.y
|
||||
);
|
||||
|
||||
if (newScale > 1) {
|
||||
this.transform.x = fixedPosition.x + deltaX;
|
||||
this.transform.y = fixedPosition.y + deltaY;
|
||||
} else if (Math.abs(deltaX) > Math.abs(deltaY)) {
|
||||
this.transform.x = fixedPosition.x + deltaX;
|
||||
} else {
|
||||
this.transform.y = fixedPosition.y + deltaY;
|
||||
}
|
||||
|
||||
this.transform.x = fixedPosition.x + deltaX;
|
||||
this.transform.y = fixedPosition.y + deltaY;
|
||||
this.transform.scale = newScale;
|
||||
this.correctPosition();
|
||||
};
|
||||
|
||||
const touchEnd = (endEvent) => {
|
||||
|
@ -302,6 +295,8 @@ export default {
|
|||
if (centerY < 0 || heightScaled + centerY > containerHeight) {
|
||||
this.transform.y = startTransformY + newY;
|
||||
}
|
||||
|
||||
this.correctPosition();
|
||||
};
|
||||
|
||||
const mouseUp = (upEvent) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue