From 1d50d7c3f24e98d63bbc142d851f3bb53f6aead6 Mon Sep 17 00:00:00 2001 From: cnjsstong2 Date: Sat, 11 Jan 2014 15:33:19 -0500 Subject: [PATCH] Fix bug. --- angular-panorama.js | 2 +- angular-panorama.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-panorama.js b/angular-panorama.js index 68daeba..a9eb670 100644 --- a/angular-panorama.js +++ b/angular-panorama.js @@ -131,7 +131,7 @@ angular.module('angular-panorama') function updateContainerHeight() { var minHeight=$window.innerHeight; if(iAttrs.minHeightOffset) { - minHeight+=iAttrs.minHeightOffset; + minHeight+=parseInt(iAttrs.minHeightOffset); } container.css('min-height',minHeight+'px'); } diff --git a/angular-panorama.min.js b/angular-panorama.min.js index 45eafd5..f478499 100644 --- a/angular-panorama.min.js +++ b/angular-panorama.min.js @@ -5,4 +5,4 @@ * @author Tong Shen * @license MIT License, http://www.opensource.org/licenses/MIT */ -angular.module("angular-panorama",["ngTouch"]),angular.module("angular-panorama").directive("ngPanoramaIndicators",[function(){return{restrict:"A",replace:!0,scope:{items:"=",index:"="},template:'
'}}]),angular.module("angular-panorama").directive("ngPanoramaInfinite",["$parse","$compile",function(a){return{restrict:"EA",transclude:!0,replace:!0,scope:!0,template:"",compile:function(b,c){var d=c.ngPanoramaCurrent+" in items";return b.children("li").attr("ng-repeat",d),function(b,c,d){b.items=[a(d.ngPanoramaCurrent)(b)],b.$watchCollection("panoramaCollection.position",function(c){a(d.ngPanoramaCurrent).assign(b.$parent,b.items[c])})}}}}]),angular.module("angular-panorama").directive("ngPanorama",["$compile","$parse","$swipe","$document","$window","CollectionManager",function(a,b,c,d,e,f){var g=0;return{restrict:"A",scope:!0,compile:function(h,i){h.addClass("ng-panorama-slides");for(var j,k=h.children("li"),l=0;l1){var b=h.panoramaCollection.getLastIndex(),c=h.panoramaCollection.position,e=E>F?1:-1,f=Math.min(Math.max(0,c+e),b),g=a.x-D;Math.abs(g)<=H*G&&(f=c);var i=c!==f;i?h.$apply(function(){angular.isDefined(j.ngPanoramaCycle)&&(h.panoramaCollection.position=f,x());var a=f/b*100;K.css("background-position",a+"% 50%"),h.panoramaCollection.goTo(f,!0)}):h.$apply(function(){x()})}C=0}function z(a){var b=K[0].getBoundingClientRect(),c=a.x>b.left&&a.xb.top&&a.y"),K=J.parent();k(),n&&(h.fakeArray=n),h.$watch("originalCollection");var L=b(m),M={},N=0;if(j.ngPanoramaIndex){var O=b(j.ngPanoramaIndex);angular.isFunction(O.assign)?(h.$watch("panoramaCollection.index",function(a){O.assign(h.$parent,a)}),N=O(h),h.$parent.$watch(O,function(a){void 0!==a&&h.panoramaCollection.goToIndex(a,!0)})):isNaN(j.ngPanoramaIndex)||(N=parseInt(j.ngPanoramaIndex,10))}angular.isDefined(j.ngPanoramaCycle)&&(M.cycle=!0),M.index=N,q&&(M.bufferSize=3,M.buffered=!0),h.panoramaCollection=f.create(M),h.$watch("panoramaCollection.updated",function(a){a&&x()});var P=!1;h.$watch(L,function(a){h.panoramaCollection.setItems(a,P),P=!0,0===H&&w(),x()}),angular.isDefined(j.ngPanoramaWatch)&&h.$watch(m,function(a){h.panoramaCollection.setItems(a,!1),P=!0,0===H&&w(),x()},!0);var Q=["webkit","moz"];if(J[0].addEventListener("webkitTransitionEnd",o,!1),J[0].addEventListener("transitionend",o,!1),window.addEventListener("orientationchange",v),window.addEventListener("resize",v),angular.isDefined(j.ngPanoramaBackgroundImage)&&(K.css("background-image","url("+j.ngPanoramaBackgroundImage+")"),K.css("background-position","0% 50%")),j.$observe("ngPanoramaBackgroundImage",function(a){a&&(K.css("background-image","url("+a+")"),K.css("background-position",h.panoramaCollection.position/h.panoramaCollection.lastIndex*100+"% 50%"))}),angular.isDefined(j.ngPanoramaIndicator)){var R=a("
")(h);K.append(R)}var S=null,T=e.jasmine||"iPad"==e.navigator.platform?0:50;c.bind(J,{start:function(a){0===C&&(C=1,D=a.x),d.bind("mouseup",A)},move:function(a){if(!z(a))return y(a),void 0;if(0!==C){var b=a.x-D;if(1===C&&0!==b)C=2,E=F;else if(2===C){var c=(new Date).getTime();if(S&&T>c-S)return;S=c;var d=h.panoramaCollection.getLastIndex(),e=h.panoramaCollection.position,f=1;(0===e&&a.x>D||e===d&&a.x0?Math.max(0,(this.position-1)%this.length()):0;this.goTo(a)}},a.prototype.setBufferSize=function(a){this.log("setBufferSize",a),this.bufferSize=a,this.adjustBuffer()},a.prototype.isBuffered=function(){return this.buffered},a.prototype.getRelativeIndex=function(){var a=Math.max(0,Math.min(this.getLastIndex(),this.position-this.bufferStart));return a},a.prototype.adjustBuffer=function(){var a=(this.getLastIndex()+1-this.bufferSize)%this.length();this.log("maxBufferStart",a),this.bufferStart=Math.max(0,Math.min(a,this.position-1)),this.cards=this.items.slice(this.bufferStart,this.bufferStart+this.bufferSize),this.log("adjustBuffer from",this.bufferStart,"to",this.bufferStart+this.bufferSize)},a.prototype.length=function(){return this.items.length},a.prototype.getLastIndex=function(){var a=Math.max(0,this.length()-1);return a},a.prototype.init=function(){this.setBufferSize(this.isBuffered()?this.bufferSize:this.length()),this.length()>0&&this.goToIndex(this.index)},a.prototype.setItems=function(a,b){this.log("setItems",a,b),b&&(this.index=0,this.position=0),this.items=a||[],this.init()},a.prototype.cycleAtEnd=function(){this.push(this.items.shift())},a.prototype.push=function(a,b){this.log("push item(s)",a,b),this.items.push(a),b&&(this.adjustBuffer(),this.updated=new Date),this.buffered||this.bufferSize++},a.prototype.unshift=function(a,b){this.log("unshift item(s)",a,b),this.items.unshift(a),this.buffered||this.bufferSize++,b&&(this.position++,this.adjustBuffer(),this.updated=new Date)},a.prototype.cycleAtBeginning=function(){this.unshift(this.items.pop())},a.prototype.getOffsetWithWidth=function(a){if(this.items[0]&&this.items[0].width){var b=0,c=this.index;if(0==c)return 0;for(var d in this.cards.slice(0,a))b+=this.cards[d].width;return b-=c'}}]),angular.module("angular-panorama").directive("ngPanoramaInfinite",["$parse","$compile",function(a){return{restrict:"EA",transclude:!0,replace:!0,scope:!0,template:"
",compile:function(b,c){var d=c.ngPanoramaCurrent+" in items";return b.children("li").attr("ng-repeat",d),function(b,c,d){b.items=[a(d.ngPanoramaCurrent)(b)],b.$watchCollection("panoramaCollection.position",function(c){a(d.ngPanoramaCurrent).assign(b.$parent,b.items[c])})}}}}]),angular.module("angular-panorama").directive("ngPanorama",["$compile","$parse","$swipe","$document","$window","CollectionManager",function(a,b,c,d,e,f){var g=0;return{restrict:"A",scope:!0,compile:function(h,i){h.addClass("ng-panorama-slides");for(var j,k=h.children("li"),l=0;l1){var b=h.panoramaCollection.getLastIndex(),c=h.panoramaCollection.position,e=E>F?1:-1,f=Math.min(Math.max(0,c+e),b),g=a.x-D;Math.abs(g)<=H*G&&(f=c);var i=c!==f;i?h.$apply(function(){angular.isDefined(j.ngPanoramaCycle)&&(h.panoramaCollection.position=f,x());var a=f/b*100;K.css("background-position",a+"% 50%"),h.panoramaCollection.goTo(f,!0)}):h.$apply(function(){x()})}C=0}function z(a){var b=K[0].getBoundingClientRect(),c=a.x>b.left&&a.xb.top&&a.y"),K=J.parent();k(),n&&(h.fakeArray=n),h.$watch("originalCollection");var L=b(m),M={},N=0;if(j.ngPanoramaIndex){var O=b(j.ngPanoramaIndex);angular.isFunction(O.assign)?(h.$watch("panoramaCollection.index",function(a){O.assign(h.$parent,a)}),N=O(h),h.$parent.$watch(O,function(a){void 0!==a&&h.panoramaCollection.goToIndex(a,!0)})):isNaN(j.ngPanoramaIndex)||(N=parseInt(j.ngPanoramaIndex,10))}angular.isDefined(j.ngPanoramaCycle)&&(M.cycle=!0),M.index=N,q&&(M.bufferSize=3,M.buffered=!0),h.panoramaCollection=f.create(M),h.$watch("panoramaCollection.updated",function(a){a&&x()});var P=!1;h.$watch(L,function(a){h.panoramaCollection.setItems(a,P),P=!0,0===H&&w(),x()}),angular.isDefined(j.ngPanoramaWatch)&&h.$watch(m,function(a){h.panoramaCollection.setItems(a,!1),P=!0,0===H&&w(),x()},!0);var Q=["webkit","moz"];if(J[0].addEventListener("webkitTransitionEnd",o,!1),J[0].addEventListener("transitionend",o,!1),window.addEventListener("orientationchange",v),window.addEventListener("resize",v),angular.isDefined(j.ngPanoramaBackgroundImage)&&(K.css("background-image","url("+j.ngPanoramaBackgroundImage+")"),K.css("background-position","0% 50%")),j.$observe("ngPanoramaBackgroundImage",function(a){a&&(K.css("background-image","url("+a+")"),K.css("background-position",h.panoramaCollection.position/h.panoramaCollection.lastIndex*100+"% 50%"))}),angular.isDefined(j.ngPanoramaIndicator)){var R=a("
")(h);K.append(R)}var S=null,T=e.jasmine||"iPad"==e.navigator.platform?0:50;c.bind(J,{start:function(a){0===C&&(C=1,D=a.x),d.bind("mouseup",A)},move:function(a){if(!z(a))return y(a),void 0;if(0!==C){var b=a.x-D;if(1===C&&0!==b)C=2,E=F;else if(2===C){var c=(new Date).getTime();if(S&&T>c-S)return;S=c;var d=h.panoramaCollection.getLastIndex(),e=h.panoramaCollection.position,f=1;(0===e&&a.x>D||e===d&&a.x0?Math.max(0,(this.position-1)%this.length()):0;this.goTo(a)}},a.prototype.setBufferSize=function(a){this.log("setBufferSize",a),this.bufferSize=a,this.adjustBuffer()},a.prototype.isBuffered=function(){return this.buffered},a.prototype.getRelativeIndex=function(){var a=Math.max(0,Math.min(this.getLastIndex(),this.position-this.bufferStart));return a},a.prototype.adjustBuffer=function(){var a=(this.getLastIndex()+1-this.bufferSize)%this.length();this.log("maxBufferStart",a),this.bufferStart=Math.max(0,Math.min(a,this.position-1)),this.cards=this.items.slice(this.bufferStart,this.bufferStart+this.bufferSize),this.log("adjustBuffer from",this.bufferStart,"to",this.bufferStart+this.bufferSize)},a.prototype.length=function(){return this.items.length},a.prototype.getLastIndex=function(){var a=Math.max(0,this.length()-1);return a},a.prototype.init=function(){this.setBufferSize(this.isBuffered()?this.bufferSize:this.length()),this.length()>0&&this.goToIndex(this.index)},a.prototype.setItems=function(a,b){this.log("setItems",a,b),b&&(this.index=0,this.position=0),this.items=a||[],this.init()},a.prototype.cycleAtEnd=function(){this.push(this.items.shift())},a.prototype.push=function(a,b){this.log("push item(s)",a,b),this.items.push(a),b&&(this.adjustBuffer(),this.updated=new Date),this.buffered||this.bufferSize++},a.prototype.unshift=function(a,b){this.log("unshift item(s)",a,b),this.items.unshift(a),this.buffered||this.bufferSize++,b&&(this.position++,this.adjustBuffer(),this.updated=new Date)},a.prototype.cycleAtBeginning=function(){this.unshift(this.items.pop())},a.prototype.getOffsetWithWidth=function(a){if(this.items[0]&&this.items[0].width){var b=0,c=this.index;if(0==c)return 0;for(var d in this.cards.slice(0,a))b+=this.cards[d].width;return b-=c