Permalink
Browse files

4.0.6 build

  • Loading branch information...
1 parent dbb3a1f commit 144b4af7f0bdcb261f2f742f33c69285c0ad4d8f @dimsemenov committed Feb 25, 2015
View
@@ -16,7 +16,7 @@
"trailing": true,
"undef": true,
"unused": true,
- "maxlen": 130,
+ "maxlen": 140,
"predef": [
"define",
@@ -180,12 +180,12 @@
color: #000;
text-decoration: none;
font-size: 14px;
- line-height: 18px;
- /* round corners on the first/last list item */ }
+ line-height: 18px; }
.pswp__share-tooltip a:hover {
text-decoration: none;
color: #000; }
.pswp__share-tooltip a:first-child {
+ /* round corners on the first/last list item */
border-radius: 2px 2px 0 0; }
.pswp__share-tooltip a:last-child {
border-radius: 0 0 2px 2px; }
@@ -1,4 +1,4 @@
-/*! PhotoSwipe Default UI - 4.0.5 - 2015-01-27
+/*! PhotoSwipe Default UI - 4.0.6 - 2015-02-25
* http://photoswipe.com
* Copyright (c) 2015 Dmitry Semenov; */
/**
@@ -694,8 +694,18 @@ var PhotoSwipeUI_Default =
_countNumItems();
};
- ui.updateFullscreen = function() {
- _togglePswpClass(pswp.template, 'fs', _fullscrenAPI.isFullscreen());
+ ui.updateFullscreen = function(e) {
+
+ if(e) {
+ // some browsers change window scroll position during the fullscreen
+ // so PhotoSwipe updates it just in case
+ setTimeout(function() {
+ pswp.setScrollOffset( 0, framework.getScrollY() );
+ }, 50);
+ }
+
+ // toogle pswp--fs class on root element
+ framework[ (_fullscrenAPI.isFullscreen() ? 'add' : 'remove') + 'Class' ](pswp.template, 'pswp--fs');
};
ui.updateIndexIndicator = function() {
Oops, something went wrong.
View
@@ -1,4 +1,4 @@
-/*! PhotoSwipe - v4.0.5 - 2015-02-16
+/*! PhotoSwipe - v4.0.6 - 2015-02-25
* http://photoswipe.com
* Copyright (c) 2015 Dmitry Semenov; */
(function (root, factory) {
@@ -376,7 +376,6 @@ var _isOpen,
_currPositionIndex = 0,
_offset,
_slideSize = _getEmptyPoint(), // size of slide area, including spacing
- _scrollChanged,
_itemHolders,
_prevItemIndex,
_indexDiff = 0, // difference of indexes since last content update
@@ -674,15 +673,7 @@ var _isOpen,
},
_onPageScroll = function() {
- _scrollChanged = true;
- // "close" on scroll works only on desktop devices, or when mouse is used
- if(_options.closeOnScroll && _isOpen && (!self.likelyTouchDevice || _options.mouseUsed) ) {
- // if scrolled for more than 2px
- if(Math.abs(framework.getScrollY() - _initalWindowScrollY) > 2) {
- _closedByScroll = true;
- self.close();
- }
- }
+ self.setScrollOffset(0, framework.getScrollY());
};
@@ -773,6 +764,10 @@ var publicMethods = {
isZooming: function() {
return _isZooming;
},
+ setScrollOffset: function(x,y) {
+ _offset.x = x;
+ _currentWindowScrollY = _offset.y = y;
+ },
applyZoomPan: function(zoomLevel,panX,panY) {
_panOffset.x = panX;
_panOffset.y = panY;
@@ -1245,9 +1240,8 @@ var publicMethods = {
_shout('resize');
},
- //Zoom current item to
+ // Zoom current item to
zoomTo: function(destZoomLevel, centerPoint, speed, easingFn, updateFn) {
-
/*
if(destZoomLevel === 'fit') {
destZoomLevel = self.currItem.fitRatio;
@@ -1277,7 +1271,7 @@ var publicMethods = {
_roundPoint(destPanOffset);
- //_startZoomLevel = destZoomLevel;
+ // _startZoomLevel = destZoomLevel;
var onUpdate = function(now) {
if(now === 1) {
_currZoomLevel = destZoomLevel;
@@ -2607,22 +2601,17 @@ var _showOrHideTimeout,
y: _panOffset.y
},
initialZoomLevel = _currZoomLevel,
- scrollY = _initalWindowScrollY,
initalBgOpacity = _bgOpacity,
onUpdate = function(now) {
- if(_scrollChanged) {
- scrollY = framework.getScrollY();
- _scrollChanged = false;
- }
if(now === 1) {
_currZoomLevel = destZoomLevel;
_panOffset.x = thumbBounds.x;
- _panOffset.y = thumbBounds.y - scrollY;
+ _panOffset.y = thumbBounds.y - _currentWindowScrollY;
} else {
_currZoomLevel = (destZoomLevel - initialZoomLevel) * now + initialZoomLevel;
_panOffset.x = (thumbBounds.x - initialPanOffset.x) * now + initialPanOffset.x;
- _panOffset.y = (thumbBounds.y - scrollY - initialPanOffset.y) * now + initialPanOffset.y;
+ _panOffset.y = (thumbBounds.y - _currentWindowScrollY - initialPanOffset.y) * now + initialPanOffset.y;
}
_applyCurrentZoomPan();
@@ -3326,6 +3315,15 @@ _registerModule('DesktopZoom', {
if(_currZoomLevel <= self.currItem.fitRatio) {
if(!_options.closeOnScroll) {
e.preventDefault();
+ } else {
+
+ // close PhotoSwipe
+ // if browser supports transforms & scroll changed enough
+ if( _transformKey && Math.abs(e.deltaY) > 2 ) {
+ _closedByScroll = true;
+ self.close();
+ }
+
}
return true;
}
@@ -3361,7 +3359,7 @@ _registerModule('DesktopZoom', {
},
toggleDesktopZoom: function(centerPoint) {
- centerPoint = centerPoint || {x:_viewportSize.x/2, y:_viewportSize.y/2 + _initalWindowScrollY };
+ centerPoint = centerPoint || {x:_viewportSize.x/2, y:_viewportSize.y/2 + _currentWindowScrollY };
var doubleTapZoomLevel = _options.getDoubleTapZoom(true, self.currItem);
var zoomOut = _currZoomLevel === doubleTapZoomLevel;
Oops, something went wrong.
@@ -21,7 +21,7 @@ markdownpage: true
## Animations
- Animation performance dramatically depends on the size of an image. The smaller image &ndash; the smoother animation. So don't be lazy and [serve responsive images](responsive-images.html), or at least don't serve images larger than 1200x1200 for phones.
-- Don't do anything during the animations Dthat can cause Paint or Layout. Don't append new elements to the DOM. Don't change `display` or `visibility`. Don't breath. You can only change `transform` and `opacity`. Delay all your changes after animation ends &ndash; use events: `beforeChange` (slide switched), `initialZoomInEnd` (initial zoom in animation ended) and `initialZoomOutEnd` (initial zoom out animation ended).
+- Don't do anything during the animations that can cause Paint or Layout. Don't append new elements to the DOM. Don't change `display` or `visibility`. Don't breath. You can only change `transform` and `opacity`. Delay all your changes after animation ends &ndash; use events: `beforeChange` (slide switched), `initialZoomInEnd` (initial zoom in animation ended) and `initialZoomOutEnd` (initial zoom out animation ended).
- Try to avoid complex `:hover` and `:active` effects on thumbnails that open PhotoSwipe if you have zoom-in/out animation enabled (apply the first rule).
- Make sure that you don't have complex styles on UI over PhotoSwipe sliding area. For example, `text-shadow` on caption text can cause issues.

0 comments on commit 144b4af

Please sign in to comment.