Skip to content

Commit c584ee0

Browse files
author
Tino Mettler
committed
Remove unused JavaScript code and outdated comments
1 parent bb3a74f commit c584ee0

File tree

2 files changed

+0
-30
lines changed

2 files changed

+0
-30
lines changed

data/website_gallery/js/gallery.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ document.addEventListener('DOMContentLoaded', function () {
5858

5959
const width = parseInt(imageObj.width);
6060
const height = parseInt(imageObj.height);
61-
const aspect = height / width;
6261
const sum = width + height;
6362
const scalefactor = sum / (framesize * 2.0);
6463
frame.style.width = (width / scalefactor) + 'vw';

data/website_gallery/js/modal.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const slides = {
2424
const prevArrow = document.getElementById('prevArrow');
2525
const nextArrow = document.getElementById('nextArrow');
2626

27-
let mouseTimer = null;
2827
let startX = 0;
2928
let startY = 0;
3029
let isDragging = false; // For swipe navigation
@@ -34,13 +33,9 @@ let hasPanned = false;
3433
let translateX = 0;
3534
let translateY = 0;
3635
let currentScale = 1;
37-
let minX = 0;
38-
let minY = 0;
39-
let containerRect, imgRect;
4036
let img;
4137

4238
let baseWidth, baseHeight; // Image dimensions before zoom
43-
let baseOffsetX, baseOffsetY; // Image position offset before zoom (due to centering)
4439

4540
let scaledWidth, scaledHeight;
4641

@@ -59,28 +54,6 @@ function updateBoundaries() {
5954
}
6055

6156
function limitPanning(proposedX, proposedY) {
62-
// With transform-origin: 0 0 and transform: translate(tx, ty) scale(s)
63-
//
64-
// Before zoom:
65-
// - Image element positioned at (baseOffsetX, baseOffsetY) in container
66-
// - Image size is (baseWidth, baseHeight)
67-
//
68-
// After transform is applied:
69-
// - First, scale happens around origin (0,0) of the element: element becomes (baseWidth*s, baseHeight*s)
70-
// - Then translate by (tx, ty) moves the whole element
71-
// - Final position in viewport: element's top-left is at (baseOffsetX + tx, baseOffsetY + ty)
72-
// - Element's bottom-right is at (baseOffsetX + tx + scaledWidth, baseOffsetY + ty + scaledHeight)
73-
//
74-
// We want the image content edges to stay within the container while allowing original borders:
75-
// - Left constraint: baseOffsetX + tx >= baseOffsetX => tx >= 0
76-
// - Right constraint: baseOffsetX + tx + scaledWidth <= containerWidth - (containerWidth - baseOffsetX - baseWidth)
77-
// baseOffsetX + tx + scaledWidth <= baseOffsetX + baseWidth
78-
// tx <= baseWidth - scaledWidth
79-
// - Top constraint: baseOffsetY + ty >= baseOffsetY => ty >= 0
80-
// - Bottom constraint: baseOffsetY + ty + scaledHeight <= baseOffsetY + baseHeight
81-
// ty <= baseHeight - scaledHeight
82-
83-
// Calculate limits
8457
const maxX = 0;
8558
const minX = baseWidth - scaledWidth;
8659

@@ -147,8 +120,6 @@ function handleZoom(e) {
147120
// Store the base (pre-zoom) dimensions and offset
148121
baseWidth = rect.width;
149122
baseHeight = rect.height;
150-
baseOffsetX = rect.left;
151-
baseOffsetY = rect.top;
152123

153124
// Calculate the scale for 1:1 pixel zoom
154125
currentScale = img.naturalWidth / rect.width;

0 commit comments

Comments
 (0)