aboutsummaryrefslogtreecommitdiff
path: root/src/lib/BadgeWall
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/BadgeWall')
-rw-r--r--src/lib/BadgeWall/BadgePreview.svelte3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/BadgeWall/BadgePreview.svelte b/src/lib/BadgeWall/BadgePreview.svelte
index 689ae927..dd2b7fd9 100644
--- a/src/lib/BadgeWall/BadgePreview.svelte
+++ b/src/lib/BadgeWall/BadgePreview.svelte
@@ -20,6 +20,7 @@
const handleMouseMove = (event: MouseEvent) => {
const boundingRectangle = badgeReference.getBoundingClientRect();
const factor = 1.25;
+ const limit = 300 * 1.75;
if ($mouse.x === 0 && $mouse.y === 0) $mouse = { x: event.clientX, y: event.clientY };
@@ -27,6 +28,8 @@
(-(event.clientX - boundingRectangle.left - boundingRectangle.width / 2) - $mouse.x) * factor;
$mouse.y +=
(-(event.clientY - boundingRectangle.top - boundingRectangle.height / 2) - $mouse.y) * factor;
+ $mouse.x = Math.max(Math.min($mouse.x, limit), -limit);
+ $mouse.y = Math.max(Math.min($mouse.y, limit), -limit);
};
const handleMouseLeave = () => {