Skip to content

Commit 9fee6ba

Browse files
committed
* add red dot
1 parent 4195619 commit 9fee6ba

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ <h2 class="text-center mb-4">LookyLooky</h2>
7373
<div id="slideShowContainer" class="d-none">
7474
<div id="slideshow">
7575
<div id="navigator"></div>
76+
<img id="mainImage" src="" alt="Start your slideshow by Uploading your first PDF" class="img-fluid card">
7677

77-
<img id="mainImage" src="" alt="Start your slideshow by Uploading your first PDF" class="img-fluid card">
7878

7979

8080
<hr>

src/startSlideshow.mjs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,18 @@ export async function loadSlideshow(id) {
8181

8282
}
8383

84+
85+
// Funktion zur Erfassung der Mausposition über dem Bild
8486
function trackMousePosition(event) {
8587
if (docId) {
8688
const rect = mainImage.getBoundingClientRect();
87-
const xPercent = ((event.clientX - rect.left) / rect.width) * 100;
88-
const yPercent = ((event.clientY - rect.top) / rect.height) * 100;
89+
const computedStyle = window.getComputedStyle(mainImage);
90+
const paddingLeft = parseFloat(computedStyle.paddingLeft);
91+
const paddingTop = parseFloat(computedStyle.paddingTop);
92+
const paddingRight = parseFloat(computedStyle.paddingRight);
93+
const paddingBottom = parseFloat(computedStyle.paddingBottom);
94+
const xPercent = ((event.clientX - rect.left - paddingLeft) / (rect.width-paddingLeft-paddingRight)) * 100;
95+
const yPercent = ((event.clientY - rect.top - paddingTop) / (rect.height-paddingTop-paddingBottom)) * 100;
8996

9097
socket.emit("mouseMove", {docId: docId, x: xPercent, y: yPercent});
9198
}

0 commit comments

Comments
 (0)