Skip to content

Commit

Permalink
timmywil#582: Fix contain outside when element is smaller than parent
Browse files Browse the repository at this point in the history
  • Loading branch information
jcnventura committed Dec 19, 2021
1 parent 91e46b4 commit 2a8ccf2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/panzoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ function Panzoom(
diffHorizontal) /
toScale
const maxX = (diffHorizontal - dims.parent.padding.left) / toScale
result.x = Math.max(Math.min(result.x, maxX), minX)
result.x = Math.max(Math.min(result.x, Math.max(minX, maxX)), Math.min(minX, maxX))
const minY =
(-(scaledHeight - dims.parent.height) -
dims.parent.padding.top -
Expand All @@ -268,7 +268,7 @@ function Panzoom(
diffVertical) /
toScale
const maxY = (diffVertical - dims.parent.padding.top) / toScale
result.y = Math.max(Math.min(result.y, maxY), minY)
result.y = Math.max(Math.min(result.y, Math.max(minY, maxY)), Math.min(minY, maxY))
}
}
return result
Expand Down

0 comments on commit 2a8ccf2

Please sign in to comment.