@@ -639,6 +639,7 @@ define([
639
639
e . preventDefault ( ) ;
640
640
pinchDimention = getDimention ( e . originalEvent ) ;
641
641
isDragActive = false ;
642
+
642
643
if ( $image . hasClass ( imageDraggableClass ) ) {
643
644
$image . removeClass ( imageDraggableClass ) ;
644
645
}
@@ -670,6 +671,7 @@ define([
670
671
if ( e && e . originalEvent . touches && e . originalEvent . touches . length >= 2 ) {
671
672
e . preventDefault ( ) ;
672
673
var currentDimention = getDimention ( e . originalEvent ) ;
674
+
673
675
if ( $image . hasClass ( imageDraggableClass ) ) {
674
676
$image . removeClass ( imageDraggableClass ) ;
675
677
}
@@ -726,7 +728,7 @@ define([
726
728
imagePosX = $ ( fullscreenImageSelector , $gallery ) . offset ( ) . left ;
727
729
imagePosY = $ ( fullscreenImageSelector , $gallery ) . offset ( ) . top ;
728
730
} ;
729
-
731
+
730
732
if ( ( $focus . attr ( 'data-gallery-role' ) || ! $focus . length ) && allowZoomOut ) {
731
733
if ( isFullScreen ) {
732
734
imagePosX = $ ( fullscreenImageSelector , $ ( gallerySelector ) ) . offset ( ) . left ;
@@ -766,7 +768,7 @@ define([
766
768
}
767
769
}
768
770
}
769
-
771
+
770
772
if ( e . keyCode === 27 && isFullScreen && allowZoomOut ) {
771
773
$ ( gallerySelector ) . data ( 'fotorama' ) . cancelFullScreen ( ) ;
772
774
}
@@ -781,7 +783,7 @@ define([
781
783
782
784
if ( gallery . fullScreen ) {
783
785
784
- if ( $image . offset ( ) && ( $image . width ( ) > $imageContainer . width ( ) ) ) {
786
+ if ( $image . offset ( ) && $image . width ( ) > $imageContainer . width ( ) ) {
785
787
endX = $image . offset ( ) . left ;
786
788
}
787
789
@@ -791,9 +793,15 @@ define([
791
793
} ) ;
792
794
793
795
$ ( window ) . resize ( function ( ) {
796
+ var imageSize = getImageSize ( $ ( fullscreenImageSelector ) [ 0 ] . src ) ,
797
+ isImageSmall =
798
+ $ ( fullscreenImageSelector ) . parent ( ) . width ( ) >= imageSize . rw &&
799
+ $ ( fullscreenImageSelector ) . parent ( ) . height ( ) >= imageSize . rh ;
800
+
794
801
toggleZoomButtons ( $image , isTouchEnabled , checkForVideo ( fotorama . activeFrame . $stageFrame ) ) ;
795
802
calculateMinSize ( $image ) ;
796
- if ( $image . hasClass ( imageZoommable ) && ! allowZoomOut ) {
803
+
804
+ if ( $image . hasClass ( imageZoommable ) && ! allowZoomOut || isImageSmall ) {
797
805
resetVars ( $image ) ;
798
806
}
799
807
} ) ;
@@ -826,7 +834,7 @@ define([
826
834
isClick = initPos [ 0 ] === pos [ 0 ] && initPos [ 1 ] === pos [ 1 ] ,
827
835
isImg = $ ( e . target ) . parent ( ) . data ( 'active' ) ;
828
836
829
- if ( isArrow || ( isImg && ! isClick ) ) {
837
+ if ( isArrow || isImg && ! isClick ) {
830
838
hideMagnifier ( ) ;
831
839
}
832
840
}
@@ -866,8 +874,10 @@ define([
866
874
867
875
$ ( element ) . on ( 'fotorama:load fotorama:showend fotorama:fullscreenexit fotorama:ready' , function ( e , fotorama ) {
868
876
var $activeStageFrame = $ ( gallerySelector ) . data ( 'fotorama' ) . activeFrame . $stageFrame ;
877
+
869
878
if ( ! $activeStageFrame . find ( magnifierZoomSelector ) . length ) {
870
879
hideMagnifier ( ) ;
880
+
871
881
if ( config . magnifierOpts ) {
872
882
config . magnifierOpts . large = $ ( gallerySelector ) . data ( 'fotorama' ) . activeFrame . img ;
873
883
config . magnifierOpts . full = fotorama . data [ fotorama . activeIndex ] . original ;
@@ -951,7 +961,8 @@ define([
951
961
} )
952
962
. on ( 'fotorama:load' , function ( e , fotorama ) {
953
963
if ( $ ( gallerySelector ) . data ( 'fotorama' ) . fullScreen ) {
954
- toggleZoomButtons ( $ ( fullscreenImageSelector ) , isTouchEnabled , checkForVideo ( fotorama . activeFrame . $stageFrame ) ) ;
964
+ toggleZoomButtons ( $ ( fullscreenImageSelector ) , isTouchEnabled ,
965
+ checkForVideo ( fotorama . activeFrame . $stageFrame ) ) ;
955
966
}
956
967
magnifierFullscreen ( fotorama ) ;
957
968
} )
0 commit comments