@@ -24,13 +24,12 @@ const slides = {
2424const prevArrow = document . getElementById ( 'prevArrow' ) ;
2525const nextArrow = document . getElementById ( 'nextArrow' ) ;
2626
27- // State management
2827let mouseTimer = null ;
2928let startX = 0 ;
3029let startY = 0 ;
31- let isDragging = false ;
30+ let isDragging = false ; // For swipe navigation
3231let isZoomed = false ;
33- let isPanning = false ;
32+ let isPanning = false ; // Panning in zoomed state
3433let hasPanned = false ;
3534let translateX = 0 ;
3635let translateY = 0 ;
@@ -57,14 +56,6 @@ function updateBoundaries() {
5756 // Calculate the actual scaled dimensions based on the base (pre-zoom) size
5857 scaledWidth = baseWidth * currentScale ;
5958 scaledHeight = baseHeight * currentScale ;
60- console . log ( 'Boundaries:' , {
61- containerRect,
62- scaledWidth,
63- scaledHeight,
64- baseWidth,
65- baseHeight,
66- currentScale
67- } ) ;
6859}
6960
7061function limitPanning ( proposedX , proposedY ) {
@@ -116,15 +107,6 @@ function limitPanning(proposedX, proposedY) {
116107 constrainedY = ( baseHeight - scaledHeight ) / 2 ;
117108 }
118109
119- console . log ( 'limitPanning:' , {
120- proposed : { x : proposedX , y : proposedY } ,
121- constrained : { x : constrainedX , y : constrainedY } ,
122- limits : { minX, maxX, minY, maxY } ,
123- baseOffset : { x : baseOffsetX , y : baseOffsetY } ,
124- baseSize : { w : baseWidth , h : baseHeight } ,
125- scaledSize : { w : scaledWidth , h : scaledHeight }
126- } ) ;
127-
128110 return {
129111 x : constrainedX ,
130112 y : constrainedY
@@ -299,22 +281,6 @@ async function handleTouchEnd(e) {
299281 }
300282}
301283
302- function handleMouseMove ( ) {
303- if ( isZoomed ) return ;
304-
305- prevArrow . classList . add ( 'visible' ) ;
306- nextArrow . classList . add ( 'visible' ) ;
307-
308- if ( mouseTimer ) {
309- clearTimeout ( mouseTimer ) ;
310- }
311-
312- mouseTimer = setTimeout ( ( ) => {
313- prevArrow . classList . remove ( 'visible' ) ;
314- nextArrow . classList . remove ( 'visible' ) ;
315- } , 1000 ) ;
316- }
317-
318284function handleKeyDown ( e ) {
319285 if ( isZoomed ) return ;
320286
@@ -342,9 +308,6 @@ container.addEventListener('touchmove', handleTouchMove);
342308container . addEventListener ( 'touchend' , handleTouchEnd ) ;
343309container . addEventListener ( 'click' , handleZoom ) ;
344310
345- // make nav arrows visible
346- document . addEventListener ( 'mousemove' , handleMouseMove ) ;
347-
348311document . addEventListener ( 'keydown' , handleKeyDown ) ;
349312prevArrow . addEventListener ( 'click' , showPreviousImage ) ;
350313nextArrow . addEventListener ( 'click' , showNextImage ) ;
@@ -417,8 +380,5 @@ container.addEventListener('touchmove', function(e) {
417380container . addEventListener ( 'touchend' , function ( e ) {
418381 if ( isPanning ) {
419382 isPanning = false ;
420- if ( ! hasPanned ) {
421- handleZoomTap ( e . changedTouches [ 0 ] ) ;
422- }
423383 }
424384} ) ;
0 commit comments