Skip to content

Commit

Permalink
4.0.6 build
Browse files Browse the repository at this point in the history
  • Loading branch information
dimsemenov committed Feb 25, 2015
1 parent dbb3a1f commit 144b4af
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"trailing": true,
"undef": true,
"unused": true,
"maxlen": 130,
"maxlen": 140,

"predef": [
"define",
Expand Down
4 changes: 2 additions & 2 deletions dist/default-skin/default-skin.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
16 changes: 13 additions & 3 deletions dist/photoswipe-ui-default.js
Original file line number Diff line number Diff line change
@@ -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; */
/**
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions dist/photoswipe-ui-default.min.js

Large diffs are not rendered by default.

42 changes: 20 additions & 22 deletions dist/photoswipe.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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());
};


Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1277,7 +1271,7 @@ var publicMethods = {

_roundPoint(destPanOffset);

//_startZoomLevel = destZoomLevel;
// _startZoomLevel = destZoomLevel;
var onUpdate = function(now) {
if(now === 1) {
_currZoomLevel = destZoomLevel;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions dist/photoswipe.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion website/documentation/performance-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 144b4af

Please sign in to comment.