Version Description
= 7.5.07 =
- This version addresses various bug fixes and feature requests.
Download this release
Release Info
Developer | opajaap |
Plugin | WP Photo Album Plus |
Version | 7.5.07.002 |
Comparing to | |
See all releases |
Code changes from version 7.5.07.001 to 7.5.07.002
- changelog.txt +1 -0
- js/wppa-all.js +1 -1
- js/wppa-zoom.js +89 -18
- js/wppa-zoom.min.js +1 -1
- wppa.php +2 -2
changelog.txt
CHANGED
@@ -4,6 +4,7 @@ WP Photo Album Plus Changelog
|
|
4 |
|
5 |
* Fixed a layout issue in lightbox.
|
6 |
* Fixed a compatibility issue with search plugins.
|
|
|
7 |
|
8 |
= 7.5.06 =
|
9 |
|
4 |
|
5 |
* Fixed a layout issue in lightbox.
|
6 |
* Fixed a compatibility issue with search plugins.
|
7 |
+
* Fullscreen lightbox will now initially display the zoomable image screen-filling with the capability of zooming out.
|
8 |
|
9 |
= 7.5.06 =
|
10 |
|
js/wppa-all.js
CHANGED
@@ -13,4 +13,4 @@ var wppaJsPopupVersion="7.5.03";function wppaPopUp(p,t,e,r,a,i,o,n,d,s){var c,l,
|
|
13 |
// wppa-touch
|
14 |
var wppaJsTouchVersion="7.5.03",wppaTriggerElementID=null,wppaFingerCount=0,wppaStartX=0,wppaStartY=0,wppaCurX=0,wppaCurY=0,wppaDeltaX=0,wppaDeltaY=0,wppaHorzDiff=0,wppaVertDiff=0,wppaMinLength=72,wppaSwipeLength=0,wppaSwipeAngle=null,wppaSwipeDirection=null,wppaSwipeOnLightbox=!1,wppaSwipeMocc=0,wppaMobileTimeStart=0;function wppaStartTime(){var p=(new Date).getTime();return wppaMobileTimeStart=p,!0}function wppaInTime(){return(new Date).getTime()-wppaMobileTimeStart<250}function wppaTapLink(p,e){wppaInTime()&&(_bumpClickCount(p),document.location.href=e)}function wppaTouchStart(p,e,a){-1==(wppaSwipeMocc=a)&&(wppaSwipeOnLightbox=!0,p.preventDefault()),1==(wppaFingerCount=p.touches.length)?(wppaStartX=p.touches[0].pageX,wppaStartY=p.touches[0].pageY,wppaTriggerElementID=e):wppaTouchCancel()}function wppaTouchMove(p){wppaSwipeOnLightbox&&p.preventDefault(),1==p.touches.length?(wppaCurX=p.touches[0].pageX,wppaCurY=p.touches[0].pageY):wppaTouchCancel()}function wppaTouchEnd(p){wppaSwipeOnLightbox&&p.preventDefault(),1==wppaFingerCount&&0!=wppaCurX&&(wppaSwipeLength=Math.round(Math.sqrt(Math.pow(wppaCurX-wppaStartX,2)+Math.pow(wppaCurY-wppaStartY,2))),wppaMinLength<=wppaSwipeLength&&(wppaCalculateAngle(),wppaDetermineSwipeDirection(),wppaProcessingRoutine())),wppaTouchCancel()}function wppaTouchCancel(){wppaTriggerElementID=wppaSwipeDirection=wppaSwipeAngle=null,wppaSwipeOnLightbox=!1,wppaSwipeMocc=wppaSwipeLength=wppaVertDiff=wppaHorzDiff=wppaDeltaY=wppaDeltaX=wppaCurY=wppaCurX=wppaStartY=wppaStartX=wppaFingerCount=0}function wppaCalculateAngle(){var p=wppaStartX-wppaCurX,e=wppaCurY-wppaStartY,a=(Math.round(Math.sqrt(Math.pow(p,2)+Math.pow(e,2))),Math.atan2(e,p));(wppaSwipeAngle=Math.round(180*a/Math.PI))<0&&(wppaSwipeAngle=360-Math.abs(wppaSwipeAngle))}function wppaDetermineSwipeDirection(){wppaSwipeDirection=wppaSwipeAngle<=45&&0<=wppaSwipeAngle||wppaSwipeAngle<=360&&315<=wppaSwipeAngle?"left":135<=wppaSwipeAngle&&wppaSwipeAngle<=225?"right":45<wppaSwipeAngle&&wppaSwipeAngle<135?"down":"up"}function wppaProcessingRoutine(){document.getElementById(wppaTriggerElementID);if(wppaSwipeOnLightbox)"left"==wppaSwipeDirection?wppaOvlShowNext():"right"==wppaSwipeDirection&&wppaOvlShowPrev();else{if("right"==wppaSwipeDirection){if(idx=_wppaCurIdx[wppaSwipeMocc]-1,idx<0){if(!wppaSlideWrap)return;idx=_wppaSlides[wppaSwipeMocc].length-1}wppaGotoKeepState(wppaSwipeMocc,idx)}if("left"==wppaSwipeDirection){if(idx=_wppaCurIdx[wppaSwipeMocc]+1,idx==_wppaSlides[wppaSwipeMocc].length){if(!wppaSlideWrap)return;idx=0}wppaGotoKeepState(wppaSwipeMocc,idx)}}wppaTouchCancel()}
|
15 |
// wppa-zoom
|
16 |
-
function wppaDoZoomPan(){for(var
|
13 |
// wppa-touch
|
14 |
var wppaJsTouchVersion="7.5.03",wppaTriggerElementID=null,wppaFingerCount=0,wppaStartX=0,wppaStartY=0,wppaCurX=0,wppaCurY=0,wppaDeltaX=0,wppaDeltaY=0,wppaHorzDiff=0,wppaVertDiff=0,wppaMinLength=72,wppaSwipeLength=0,wppaSwipeAngle=null,wppaSwipeDirection=null,wppaSwipeOnLightbox=!1,wppaSwipeMocc=0,wppaMobileTimeStart=0;function wppaStartTime(){var p=(new Date).getTime();return wppaMobileTimeStart=p,!0}function wppaInTime(){return(new Date).getTime()-wppaMobileTimeStart<250}function wppaTapLink(p,e){wppaInTime()&&(_bumpClickCount(p),document.location.href=e)}function wppaTouchStart(p,e,a){-1==(wppaSwipeMocc=a)&&(wppaSwipeOnLightbox=!0,p.preventDefault()),1==(wppaFingerCount=p.touches.length)?(wppaStartX=p.touches[0].pageX,wppaStartY=p.touches[0].pageY,wppaTriggerElementID=e):wppaTouchCancel()}function wppaTouchMove(p){wppaSwipeOnLightbox&&p.preventDefault(),1==p.touches.length?(wppaCurX=p.touches[0].pageX,wppaCurY=p.touches[0].pageY):wppaTouchCancel()}function wppaTouchEnd(p){wppaSwipeOnLightbox&&p.preventDefault(),1==wppaFingerCount&&0!=wppaCurX&&(wppaSwipeLength=Math.round(Math.sqrt(Math.pow(wppaCurX-wppaStartX,2)+Math.pow(wppaCurY-wppaStartY,2))),wppaMinLength<=wppaSwipeLength&&(wppaCalculateAngle(),wppaDetermineSwipeDirection(),wppaProcessingRoutine())),wppaTouchCancel()}function wppaTouchCancel(){wppaTriggerElementID=wppaSwipeDirection=wppaSwipeAngle=null,wppaSwipeOnLightbox=!1,wppaSwipeMocc=wppaSwipeLength=wppaVertDiff=wppaHorzDiff=wppaDeltaY=wppaDeltaX=wppaCurY=wppaCurX=wppaStartY=wppaStartX=wppaFingerCount=0}function wppaCalculateAngle(){var p=wppaStartX-wppaCurX,e=wppaCurY-wppaStartY,a=(Math.round(Math.sqrt(Math.pow(p,2)+Math.pow(e,2))),Math.atan2(e,p));(wppaSwipeAngle=Math.round(180*a/Math.PI))<0&&(wppaSwipeAngle=360-Math.abs(wppaSwipeAngle))}function wppaDetermineSwipeDirection(){wppaSwipeDirection=wppaSwipeAngle<=45&&0<=wppaSwipeAngle||wppaSwipeAngle<=360&&315<=wppaSwipeAngle?"left":135<=wppaSwipeAngle&&wppaSwipeAngle<=225?"right":45<wppaSwipeAngle&&wppaSwipeAngle<135?"down":"up"}function wppaProcessingRoutine(){document.getElementById(wppaTriggerElementID);if(wppaSwipeOnLightbox)"left"==wppaSwipeDirection?wppaOvlShowNext():"right"==wppaSwipeDirection&&wppaOvlShowPrev();else{if("right"==wppaSwipeDirection){if(idx=_wppaCurIdx[wppaSwipeMocc]-1,idx<0){if(!wppaSlideWrap)return;idx=_wppaSlides[wppaSwipeMocc].length-1}wppaGotoKeepState(wppaSwipeMocc,idx)}if("left"==wppaSwipeDirection){if(idx=_wppaCurIdx[wppaSwipeMocc]+1,idx==_wppaSlides[wppaSwipeMocc].length){if(!wppaSlideWrap)return;idx=0}wppaGotoKeepState(wppaSwipeMocc,idx)}}wppaTouchCancel()}
|
15 |
// wppa-zoom
|
16 |
+
function wppaDoZoomPan(){for(var r,h=jQuery,a=!1,t=0;t<wppaZoomableData.length;t++)void 0!==wppaZoomableData[t]&&((r=wppaZoomableData[t]).image.complete?r.initialized||((r=wppaZoomableData[t]).manualControl=!1,r.deltaX=0,r.deltaY=0,r.deltaFactor=1,r.run=4,r.busy=!1,r.abort=!1,r.itemid=r.mocc+"-"+r.id,r.div=h("#wppa-pan-div-"+r.itemid),r.canvas=document.getElementById("wppa-pan-canvas-"+r.itemid),r.left=h("#wppa-pctl-left-"+r.itemid),r.right=h("#wppa-pctl-right-"+r.itemid),r.up=h("#wppa-pctl-up-"+r.itemid),r.down=h("#wppa-pctl-down-"+r.itemid),r.zoomin=h("#wppa-pctl-zoomin-"+r.itemid),r.zoomout=h("#wppa-pctl-zoomout-"+r.itemid),r.prev=h("#wppa-pctl-prev-"+r.itemid),r.next=h("#wppa-pctl-next-"+r.itemid),r.canvasWidth=r.width,r.canvasHeight=r.height,r.savedCanvasX=0,r.savedCanvasY=0,r.fromHeight=r.image.height,r.fromWidth=r.image.width,r.imageRatio=r.image.width/r.image.height,r.fromX=0,r.fromY=0,r.centerX=r.fromX+r.fromWidth/2,r.centerY=r.fromY+r.fromHeight/2,r.ctx=null,r.buttondown=!1,r.enableManual=!0,r.isMobile?(r.right.on("touchstart",n),r.right.on("touchend",l),r.left.on("touchstart",i),r.left.on("touchend",l),r.up.on("touchstart",p),r.up.on("touchend",l),r.down.on("touchstart",s),r.down.on("touchend",l),r.zoomin.on("touchstart",m),r.zoomin.on("touchend",l),r.zoomout.on("touchstart",d),r.zoomout.on("touchend",l)):(r.canvas.addEventListener("mousedown",f),r.canvas.addEventListener("mousemove",v),r.canvas.addEventListener("mouseup",g),r.canvas.addEventListener("mouseout",g),document.getElementById("wppa-pan-canvas-"+r.itemid).addEventListener("wheel",c),r.right.on("mousedown",n),r.right.on("mouseup",l),r.left.on("mousedown",i),r.left.on("mouseup",l),r.up.on("mousedown",p),r.up.on("mouseup",l),r.down.on("mousedown",s),r.down.on("mouseup",l),r.zoomin.on("mousedown",m),r.zoomin.on("mouseup",l),r.zoomout.on("mousedown",d),r.zoomout.on("mouseup",l)),r.isLightbox&&(h("#wppa-fulls-btn").on("click",function(){abort=!0}),r.prev&&(r.prev.on("click",o),r.next.on("click",e))),h(window).on("DOMContentLoaded load resize orientationchange",w),u(t),w(),r.initialized=!0):a=!0);function u(a){if((r=wppaZoomableData[a]).isLightbox&&(wppaOvlOpen||(r.abort=!0)),r.abort)return r.ctx=null,void(r.prevctx=null);var t,o,e,n,i;0!=r.run&&(r.busy||(r.busy=!0,r.manualControl||(r.fromX+=r.deltaX,r.fromY+=r.deltaY,t=r.fromHeight/r.deltaFactor,o=r.fromWidth/r.deltaFactor,50<t&&1!=r.deltaFactor&&(wppaIsFs()||t<=r.image.height)&&(r.fromX-=(o-r.fromWidth)/2,r.fromY-=(t-r.fromHeight)/2,r.fromWidth=o,r.fromHeight=t)),r.fromX=Math.max(0,Math.min(r.image.width-r.fromWidth,r.fromX)),r.fromY=Math.max(0,Math.min(r.image.height-r.fromHeight,r.fromY)),e=screen.width/screen.height,n=(1-r.image.width/r.fromWidth)*r.canvas.width/2,i=(1-r.image.height/r.fromHeight)*r.canvas.height/2,r.ctx=r.canvas.getContext("2d"),e>r.imageRatio&&t>r.image.height&&wppaIsFs()||e<=r.imageRatio&&o>r.image.width&&wppaIsFs()?(r.enableManual=!1,r.ctx.clearRect(0,0,r.canvas.width,r.canvas.height),r.ctx.drawImage(r.image,r.fromX,r.fromY,r.fromWidth,r.fromHeight,n,i,r.canvas.width,r.canvas.height),jQuery(r.canvas).css({cursor:"default"})):(r.enableManual=!0,r.ctx.drawImage(r.image,r.fromX,r.fromY,r.fromWidth,r.fromHeight,0,0,r.canvas.width,r.canvas.height),jQuery(r.canvas).css({cursor:"grab"})),wppaIsFs()?(r.fsMaskTop=i,r.fsMaskLeft=n,r.fsMaskBottom=r.canvas.height-i,r.fsMaskRight=r.canvas.width-n):(r.fsMaskTop=0,r.fsMaskLeft=0,r.fsMaskBottom=0,r.fsMaskRight=0),r.busy=!1,0<r.run&&(r.manualControl?setTimeout(function(){u(a)},25):r.buttondown&&setTimeout(function(){u(a)},5)),r.run<5&&r.run--,r.initializing&&(r.initializing=!1,r.run--),wppaAdjustControlbar()))}function o(a){var t;a.preventDefault(),this.abort=!0,t||(t=!0,h("#wppa-overlay-ic").css({display:"none"}),h("#wppa-ovl-spin").show(),wppaOvlShowPrev())}function e(a){var t;a.preventDefault(),this.abort=!0,t||(t=!0,h("#wppa-overlay-ic").css({display:"none"}),h("#wppa-ovl-spin").show(),wppaOvlShowNext())}function n(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=5,wppaZoomableData[t].deltaX=3,r.buttondown=!0,u(t))}function i(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=5,wppaZoomableData[t].deltaX=-3,r.buttondown=!0,u(t))}function p(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=5,wppaZoomableData[t].deltaY=-3,r.buttondown=!0,u(t))}function s(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=5,wppaZoomableData[t].deltaY=3,r.buttondown=!0,u(t))}function m(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=5,wppaZoomableData[t].deltaFactor=1.005,r.buttondown=!0,u(t))}function d(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=5,wppaZoomableData[t].deltaFactor=.995,r.buttondown=!0,u(t))}function c(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=4,wppaZoomableData[t].deltaFactor=1+a.deltaY*wppaZoomableData[t].zoomsensitivity/(wppaIsChrome?1e4:1e3),u(t),setTimeout(function(){wppaZoomableData[t].deltaFactor=1},25),a.stopPropagation())}function l(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].deltaX=0,wppaZoomableData[t].deltaY=0,wppaZoomableData[t].deltaFactor=1,wppaZoomableData[t].isLightbox?wppaZoomableData[t].run--:wppaZoomableData[t].run=4,r.buttondown=!1)}function w(a){for(var t,o,e,n,i,r,p,s,m,d,c,l=0;l<wppaZoomableData.length;l++){wppaZoomableData[l]&&wppaZoomableData[l].canvas&&!wppaZoomableData[l].abort&&(o=(t=wppaZoomableData[l]).imageRatio,t.isLightbox?(h("#wppa-overlay-ic").css("display",""),r=(n=!wppaIsFs())?(i=window.innerWidth?window.innerWidth:screen.width,window.innerHeight?window.innerHeight:screen.height):(i=screen.width,screen.height),p=parseInt(p),s=parseInt(s),c=(d=8)+(t.controls?t.icsize+10:0)+10,n?(d+=2*t.borderWidth,c+=2*t.borderWidth):d=40,n?m=(e=(i-d)/o<r-c)?(r-(s=(p=i-d)/o)-c)/2+20:(p=o*(r-(t.controls?t.icsize:0)-24),n&&(p-=24),s=p/o,20):(screenRatio=screen.width/screen.height,(e=screenRatio<o)?(p=(s=screen.height)*o,screen.width,m=0):(s=(p=screen.width)/o,m=(screen.height-s)/2,0)),h("#wppa-ovl-pan-container").css({marginTop:m}),h("#wppa-overlay-ic").css({marginTop:0}),t.canvasWidth=p,t.canvasHeight=s,t.canvas.width=t.canvasWidth,t.canvas.height=t.canvasHeight,n?(h("#wppa-ovl-pan-container").css({backgroundColor:t.backgroundColor,padding:t.padding,borderRadius:t.borderRadius,borderWidth:t.borderWidth,width:p,marginLeft:0}),h("#wppa-pctl-div-"+t.itemid).css({marginLeft:0}),e?h("#wppa-overlay-ic").css({left:4}):h("#wppa-overlay-ic").css({left:(i-p)/2})):(h("#wppa-overlay-ic").css({marginLeft:0}),h("#wppa-ovl-pan-container").css({backgroundColor:"transparent",padding:0,borderRadius:0,borderWidth:0,width:p,left:(i-p)/2,position:"fixed"}),h("#wppa-pctl-div-"+t.itemid).css({marginLeft:0}))):(t.canvasWidth=h(t.div).parent().width(),t.canvasHeight=t.canvasWidth/o,t.canvas.width=t.canvasWidth,t.canvas.height=t.canvasHeight),t.run=5,u(l))}}function f(a){a.preventDefault();var t,o=jQuery(this).attr("data-mocc");wppaZoomableData[o]&&(t=wppaZoomableData[o],wppaIsFs()&&(a.offsetX<t.fsMaskLeft||a.offsetX>t.fsMaskRight||a.offsetY<t.fsMaskTop||a.offsetY>t.fsMaskBottom)&&jQuery("#wppa-overlay-bg").trigger("click"),t.enableManual&&(t.manualControl=!0,t.savedCanvasX=a.offsetX,t.savedCanvasY=a.offsetY,t.run=5,u(o)))}function v(a){var t,o,e,n,i=jQuery(this).attr("data-mocc");!wppaZoomableData[i]||(t=wppaZoomableData[i]).manualControl&&(o=t.canvas.width/t.fromWidth,e=(t.savedCanvasX-a.offsetX)/o+t.fromX,n=(t.savedCanvasY-a.offsetY)/o+t.fromY,0<e&&0<n&&e+t.fromWidth<t.image.width&&n+t.fromHeight<t.image.height&&(t.fromX=e,t.fromY=n,t.savedCanvasX=a.offsetX,t.savedCanvasY=a.offsetY))}function g(a){var t,o=jQuery(this).attr("data-mocc");!wppaZoomableData[o]||(t=wppaZoomableData[o]).manualControl&&(t.run=4,t.manualControl=!1)}a?setTimeout(function(){wppaDoZoomPan()},300):h("#wppa-ovl-spin").hide()}
|
js/wppa-zoom.js
CHANGED
@@ -47,13 +47,14 @@ function wppaDoZoomPan() {
|
|
47 |
args.savedCanvasY = 0;
|
48 |
args.fromHeight = args.image.height;
|
49 |
args.fromWidth = args.image.width;
|
50 |
-
args.
|
51 |
args.fromX = 0;
|
52 |
args.fromY = 0;
|
53 |
args.centerX = args.fromX + args.fromWidth / 2;
|
54 |
args.centerY = args.fromY + args.fromHeight / 2;
|
55 |
args.ctx = null;
|
56 |
args.buttondown = false;
|
|
|
57 |
|
58 |
// Install event listeners
|
59 |
if ( args.isMobile ) {
|
@@ -160,7 +161,7 @@ function wppaDoZoomPan() {
|
|
160 |
var newWidth = args.fromWidth / args.deltaFactor;
|
161 |
|
162 |
// Keep zooming in range
|
163 |
-
if ( args.deltaFactor != 1 && newHeight <= args.image.height
|
164 |
args.fromX -= ( newWidth - args.fromWidth ) / 2;
|
165 |
args.fromY -= ( newHeight - args.fromHeight ) / 2;
|
166 |
args.fromWidth = newWidth;
|
@@ -172,9 +173,50 @@ function wppaDoZoomPan() {
|
|
172 |
args.fromX = Math.max(0, Math.min(args.image.width-args.fromWidth, args.fromX));
|
173 |
args.fromY = Math.max(0, Math.min(args.image.height-args.fromHeight, args.fromY));
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
// Draw the image
|
176 |
args.ctx = args.canvas.getContext("2d");
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
// Done so far
|
180 |
args.busy = false;
|
@@ -199,7 +241,6 @@ function wppaDoZoomPan() {
|
|
199 |
|
200 |
}
|
201 |
|
202 |
-
|
203 |
// Previous
|
204 |
function panPrev(e) {
|
205 |
|
@@ -343,7 +384,7 @@ function wppaDoZoomPan() {
|
|
343 |
if ( wppaZoomableData[mocc] && wppaZoomableData[mocc].canvas && ! wppaZoomableData[mocc].abort ) {
|
344 |
|
345 |
var args = wppaZoomableData[mocc];
|
346 |
-
var
|
347 |
|
348 |
if ( args.isLightbox ) { // moet nog aangepast worden
|
349 |
|
@@ -386,20 +427,36 @@ function wppaDoZoomPan() {
|
|
386 |
extraX=40;
|
387 |
}
|
388 |
|
389 |
-
// Find out if the width is the limitng dimension
|
390 |
-
widthIsLim = ( contHeight - extraY ) > ( contWidth - extraX ) / ratio;
|
391 |
-
|
392 |
// Compute new sizes and margins
|
393 |
-
if (
|
394 |
-
|
395 |
-
|
396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
}
|
398 |
else {
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
}
|
404 |
|
405 |
// Set css common for all 4 situations
|
@@ -462,7 +519,7 @@ function wppaDoZoomPan() {
|
|
462 |
// Not lightbox
|
463 |
else {
|
464 |
args.canvasWidth = $(args.div).parent().width();
|
465 |
-
args.canvasHeight = args.canvasWidth /
|
466 |
args.canvas.width = args.canvasWidth;
|
467 |
args.canvas.height = args.canvasHeight;
|
468 |
args.run=5;
|
@@ -475,12 +532,26 @@ function wppaDoZoomPan() {
|
|
475 |
// when the mouse is pressed on the canvas, we switch to manual control and save current coordinates
|
476 |
function onCanvasMouseDown(e){
|
477 |
|
|
|
|
|
478 |
var mocc = jQuery(this).attr('data-mocc');
|
479 |
if ( ! wppaZoomableData[mocc] ) return;
|
480 |
|
481 |
var args = wppaZoomableData[mocc];
|
482 |
|
483 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
args.manualControl = true;
|
485 |
args.savedCanvasX = e.offsetX;
|
486 |
args.savedCanvasY = e.offsetY;
|
47 |
args.savedCanvasY = 0;
|
48 |
args.fromHeight = args.image.height;
|
49 |
args.fromWidth = args.image.width;
|
50 |
+
args.imageRatio = args.image.width / args.image.height;
|
51 |
args.fromX = 0;
|
52 |
args.fromY = 0;
|
53 |
args.centerX = args.fromX + args.fromWidth / 2;
|
54 |
args.centerY = args.fromY + args.fromHeight / 2;
|
55 |
args.ctx = null;
|
56 |
args.buttondown = false;
|
57 |
+
args.enableManual = true;
|
58 |
|
59 |
// Install event listeners
|
60 |
if ( args.isMobile ) {
|
161 |
var newWidth = args.fromWidth / args.deltaFactor;
|
162 |
|
163 |
// Keep zooming in range
|
164 |
+
if ( newHeight > 50 && args.deltaFactor != 1 && ( wppaIsFs() || newHeight <= args.image.height ) ) {
|
165 |
args.fromX -= ( newWidth - args.fromWidth ) / 2;
|
166 |
args.fromY -= ( newHeight - args.fromHeight ) / 2;
|
167 |
args.fromWidth = newWidth;
|
173 |
args.fromX = Math.max(0, Math.min(args.image.width-args.fromWidth, args.fromX));
|
174 |
args.fromY = Math.max(0, Math.min(args.image.height-args.fromHeight, args.fromY));
|
175 |
|
176 |
+
var fact, toX, toY;
|
177 |
+
var screenRatio = screen.width / screen.height;
|
178 |
+
|
179 |
+
fact = args.image.width / args.fromWidth;
|
180 |
+
toX = ( 1 - fact ) * args.canvas.width / 2;
|
181 |
+
fact = args.image.height / args.fromHeight;
|
182 |
+
toY = ( 1 - fact ) * args.canvas.height / 2;
|
183 |
+
|
184 |
// Draw the image
|
185 |
args.ctx = args.canvas.getContext("2d");
|
186 |
+
|
187 |
+
if ( screenRatio > args.imageRatio && newHeight > args.image.height && wppaIsFs() ) {
|
188 |
+
args.enableManual = false;
|
189 |
+
args.ctx.clearRect(0, 0, args.canvas.width, args.canvas.height);
|
190 |
+
args.ctx.drawImage(args.image,args.fromX,args.fromY,args.fromWidth,args.fromHeight,toX,toY,args.canvas.width,args.canvas.height);
|
191 |
+
jQuery( args.canvas ).css({cursor:'default'});
|
192 |
+
}
|
193 |
+
else if ( screenRatio <= args.imageRatio && newWidth > args.image.width && wppaIsFs() ) {
|
194 |
+
args.enableManual = false;
|
195 |
+
args.ctx.clearRect(0, 0, args.canvas.width, args.canvas.height);
|
196 |
+
args.ctx.drawImage(args.image,args.fromX,args.fromY,args.fromWidth,args.fromHeight,toX,toY,args.canvas.width,args.canvas.height);
|
197 |
+
jQuery( args.canvas ).css({cursor:'default'});
|
198 |
+
}
|
199 |
+
else {
|
200 |
+
args.enableManual = true;
|
201 |
+
args.ctx.drawImage(args.image,args.fromX,args.fromY,args.fromWidth,args.fromHeight,0,0,args.canvas.width,args.canvas.height);
|
202 |
+
jQuery( args.canvas ).css({cursor:'grab'});
|
203 |
+
}
|
204 |
+
|
205 |
+
// Calculate image loc on screen
|
206 |
+
if ( wppaIsFs() ) {
|
207 |
+
args.fsMaskTop = toY;
|
208 |
+
args.fsMaskLeft = toX;
|
209 |
+
args.fsMaskBottom = args.canvas.height - toY;
|
210 |
+
args.fsMaskRight = args.canvas.width - toX;
|
211 |
+
}
|
212 |
+
|
213 |
+
// Not fullscreen
|
214 |
+
else {
|
215 |
+
args.fsMaskTop = 0;
|
216 |
+
args.fsMaskLeft = 0;
|
217 |
+
args.fsMaskBottom = 0;
|
218 |
+
args.fsMaskRight = 0;
|
219 |
+
}
|
220 |
|
221 |
// Done so far
|
222 |
args.busy = false;
|
241 |
|
242 |
}
|
243 |
|
|
|
244 |
// Previous
|
245 |
function panPrev(e) {
|
246 |
|
384 |
if ( wppaZoomableData[mocc] && wppaZoomableData[mocc].canvas && ! wppaZoomableData[mocc].abort ) {
|
385 |
|
386 |
var args = wppaZoomableData[mocc];
|
387 |
+
var imageRatio = args.imageRatio;
|
388 |
|
389 |
if ( args.isLightbox ) { // moet nog aangepast worden
|
390 |
|
427 |
extraX=40;
|
428 |
}
|
429 |
|
|
|
|
|
|
|
430 |
// Compute new sizes and margins
|
431 |
+
if ( modeIsNormal ) {
|
432 |
+
widthIsLim = ( contHeight - extraY ) > ( contWidth - extraX ) / imageRatio;
|
433 |
+
if ( widthIsLim ) {
|
434 |
+
newWidth = contWidth - extraX;
|
435 |
+
newHeight = newWidth / imageRatio;
|
436 |
+
topMarg = ( contHeight - newHeight - extraY ) / 2 + 20;
|
437 |
+
}
|
438 |
+
else {
|
439 |
+
newWidth = imageRatio * ( contHeight - ( args.controls ? args.icsize : 0 ) - 24 );
|
440 |
+
if ( modeIsNormal ) newWidth -= 24;
|
441 |
+
newHeight = newWidth / imageRatio;
|
442 |
+
topMarg = 20;
|
443 |
+
}
|
444 |
}
|
445 |
else {
|
446 |
+
screenRatio = screen.width / screen.height;
|
447 |
+
widthIsLim = screenRatio < imageRatio;
|
448 |
+
if ( widthIsLim ) {
|
449 |
+
newHeight = screen.height;
|
450 |
+
newWidth = newHeight * imageRatio;
|
451 |
+
leftMarg = ( screen.width - newWidth ) / 2;
|
452 |
+
topMarg = 0;
|
453 |
+
}
|
454 |
+
else {
|
455 |
+
newWidth = screen.width;
|
456 |
+
newHeight = newWidth / imageRatio;
|
457 |
+
topMarg = ( screen.height - newHeight ) / 2;
|
458 |
+
leftMarg = 0;
|
459 |
+
}
|
460 |
}
|
461 |
|
462 |
// Set css common for all 4 situations
|
519 |
// Not lightbox
|
520 |
else {
|
521 |
args.canvasWidth = $(args.div).parent().width();
|
522 |
+
args.canvasHeight = args.canvasWidth / imageRatio;
|
523 |
args.canvas.width = args.canvasWidth;
|
524 |
args.canvas.height = args.canvasHeight;
|
525 |
args.run=5;
|
532 |
// when the mouse is pressed on the canvas, we switch to manual control and save current coordinates
|
533 |
function onCanvasMouseDown(e){
|
534 |
|
535 |
+
e.preventDefault();
|
536 |
+
|
537 |
var mocc = jQuery(this).attr('data-mocc');
|
538 |
if ( ! wppaZoomableData[mocc] ) return;
|
539 |
|
540 |
var args = wppaZoomableData[mocc];
|
541 |
|
542 |
+
// If fs and outside image, transfer to wppa-overlay-bg
|
543 |
+
if ( wppaIsFs() ) {
|
544 |
+
if ( e.offsetX < args.fsMaskLeft ||
|
545 |
+
e.offsetX > args.fsMaskRight ||
|
546 |
+
e.offsetY < args.fsMaskTop ||
|
547 |
+
e.offsetY > args.fsMaskBottom ) {
|
548 |
+
jQuery( '#wppa-overlay-bg' ).trigger( 'click' );
|
549 |
+
}
|
550 |
+
}
|
551 |
+
|
552 |
+
if ( ! args.enableManual ) return;
|
553 |
+
|
554 |
+
// e.preventDefault();
|
555 |
args.manualControl = true;
|
556 |
args.savedCanvasX = e.offsetX;
|
557 |
args.savedCanvasY = e.offsetY;
|
js/wppa-zoom.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function wppaDoZoomPan(){for(var
|
1 |
+
function wppaDoZoomPan(){for(var r,h=jQuery,a=!1,t=0;t<wppaZoomableData.length;t++)void 0!==wppaZoomableData[t]&&((r=wppaZoomableData[t]).image.complete?r.initialized||((r=wppaZoomableData[t]).manualControl=!1,r.deltaX=0,r.deltaY=0,r.deltaFactor=1,r.run=4,r.busy=!1,r.abort=!1,r.itemid=r.mocc+"-"+r.id,r.div=h("#wppa-pan-div-"+r.itemid),r.canvas=document.getElementById("wppa-pan-canvas-"+r.itemid),r.left=h("#wppa-pctl-left-"+r.itemid),r.right=h("#wppa-pctl-right-"+r.itemid),r.up=h("#wppa-pctl-up-"+r.itemid),r.down=h("#wppa-pctl-down-"+r.itemid),r.zoomin=h("#wppa-pctl-zoomin-"+r.itemid),r.zoomout=h("#wppa-pctl-zoomout-"+r.itemid),r.prev=h("#wppa-pctl-prev-"+r.itemid),r.next=h("#wppa-pctl-next-"+r.itemid),r.canvasWidth=r.width,r.canvasHeight=r.height,r.savedCanvasX=0,r.savedCanvasY=0,r.fromHeight=r.image.height,r.fromWidth=r.image.width,r.imageRatio=r.image.width/r.image.height,r.fromX=0,r.fromY=0,r.centerX=r.fromX+r.fromWidth/2,r.centerY=r.fromY+r.fromHeight/2,r.ctx=null,r.buttondown=!1,r.enableManual=!0,r.isMobile?(r.right.on("touchstart",n),r.right.on("touchend",l),r.left.on("touchstart",i),r.left.on("touchend",l),r.up.on("touchstart",p),r.up.on("touchend",l),r.down.on("touchstart",s),r.down.on("touchend",l),r.zoomin.on("touchstart",m),r.zoomin.on("touchend",l),r.zoomout.on("touchstart",d),r.zoomout.on("touchend",l)):(r.canvas.addEventListener("mousedown",f),r.canvas.addEventListener("mousemove",v),r.canvas.addEventListener("mouseup",g),r.canvas.addEventListener("mouseout",g),document.getElementById("wppa-pan-canvas-"+r.itemid).addEventListener("wheel",c),r.right.on("mousedown",n),r.right.on("mouseup",l),r.left.on("mousedown",i),r.left.on("mouseup",l),r.up.on("mousedown",p),r.up.on("mouseup",l),r.down.on("mousedown",s),r.down.on("mouseup",l),r.zoomin.on("mousedown",m),r.zoomin.on("mouseup",l),r.zoomout.on("mousedown",d),r.zoomout.on("mouseup",l)),r.isLightbox&&(h("#wppa-fulls-btn").on("click",function(){abort=!0}),r.prev&&(r.prev.on("click",o),r.next.on("click",e))),h(window).on("DOMContentLoaded load resize orientationchange",w),u(t),w(),r.initialized=!0):a=!0);function u(a){if((r=wppaZoomableData[a]).isLightbox&&(wppaOvlOpen||(r.abort=!0)),r.abort)return r.ctx=null,void(r.prevctx=null);var t,o,e,n,i;0!=r.run&&(r.busy||(r.busy=!0,r.manualControl||(r.fromX+=r.deltaX,r.fromY+=r.deltaY,t=r.fromHeight/r.deltaFactor,o=r.fromWidth/r.deltaFactor,50<t&&1!=r.deltaFactor&&(wppaIsFs()||t<=r.image.height)&&(r.fromX-=(o-r.fromWidth)/2,r.fromY-=(t-r.fromHeight)/2,r.fromWidth=o,r.fromHeight=t)),r.fromX=Math.max(0,Math.min(r.image.width-r.fromWidth,r.fromX)),r.fromY=Math.max(0,Math.min(r.image.height-r.fromHeight,r.fromY)),e=screen.width/screen.height,n=(1-r.image.width/r.fromWidth)*r.canvas.width/2,i=(1-r.image.height/r.fromHeight)*r.canvas.height/2,r.ctx=r.canvas.getContext("2d"),e>r.imageRatio&&t>r.image.height&&wppaIsFs()||e<=r.imageRatio&&o>r.image.width&&wppaIsFs()?(r.enableManual=!1,r.ctx.clearRect(0,0,r.canvas.width,r.canvas.height),r.ctx.drawImage(r.image,r.fromX,r.fromY,r.fromWidth,r.fromHeight,n,i,r.canvas.width,r.canvas.height),jQuery(r.canvas).css({cursor:"default"})):(r.enableManual=!0,r.ctx.drawImage(r.image,r.fromX,r.fromY,r.fromWidth,r.fromHeight,0,0,r.canvas.width,r.canvas.height),jQuery(r.canvas).css({cursor:"grab"})),wppaIsFs()?(r.fsMaskTop=i,r.fsMaskLeft=n,r.fsMaskBottom=r.canvas.height-i,r.fsMaskRight=r.canvas.width-n):(r.fsMaskTop=0,r.fsMaskLeft=0,r.fsMaskBottom=0,r.fsMaskRight=0),r.busy=!1,0<r.run&&(r.manualControl?setTimeout(function(){u(a)},25):r.buttondown&&setTimeout(function(){u(a)},5)),r.run<5&&r.run--,r.initializing&&(r.initializing=!1,r.run--),wppaAdjustControlbar()))}function o(a){var t;a.preventDefault(),this.abort=!0,t||(t=!0,h("#wppa-overlay-ic").css({display:"none"}),h("#wppa-ovl-spin").show(),wppaOvlShowPrev())}function e(a){var t;a.preventDefault(),this.abort=!0,t||(t=!0,h("#wppa-overlay-ic").css({display:"none"}),h("#wppa-ovl-spin").show(),wppaOvlShowNext())}function n(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=5,wppaZoomableData[t].deltaX=3,r.buttondown=!0,u(t))}function i(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=5,wppaZoomableData[t].deltaX=-3,r.buttondown=!0,u(t))}function p(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=5,wppaZoomableData[t].deltaY=-3,r.buttondown=!0,u(t))}function s(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=5,wppaZoomableData[t].deltaY=3,r.buttondown=!0,u(t))}function m(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=5,wppaZoomableData[t].deltaFactor=1.005,r.buttondown=!0,u(t))}function d(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=5,wppaZoomableData[t].deltaFactor=.995,r.buttondown=!0,u(t))}function c(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].run=4,wppaZoomableData[t].deltaFactor=1+a.deltaY*wppaZoomableData[t].zoomsensitivity/(wppaIsChrome?1e4:1e3),u(t),setTimeout(function(){wppaZoomableData[t].deltaFactor=1},25),a.stopPropagation())}function l(a){var t=jQuery(this).attr("data-mocc");wppaZoomableData[t]&&(a.preventDefault(),wppaZoomableData[t].deltaX=0,wppaZoomableData[t].deltaY=0,wppaZoomableData[t].deltaFactor=1,wppaZoomableData[t].isLightbox?wppaZoomableData[t].run--:wppaZoomableData[t].run=4,r.buttondown=!1)}function w(a){for(var t,o,e,n,i,r,p,s,m,d,c,l=0;l<wppaZoomableData.length;l++){wppaZoomableData[l]&&wppaZoomableData[l].canvas&&!wppaZoomableData[l].abort&&(o=(t=wppaZoomableData[l]).imageRatio,t.isLightbox?(h("#wppa-overlay-ic").css("display",""),r=(n=!wppaIsFs())?(i=window.innerWidth?window.innerWidth:screen.width,window.innerHeight?window.innerHeight:screen.height):(i=screen.width,screen.height),p=parseInt(p),s=parseInt(s),c=(d=8)+(t.controls?t.icsize+10:0)+10,n?(d+=2*t.borderWidth,c+=2*t.borderWidth):d=40,n?m=(e=(i-d)/o<r-c)?(r-(s=(p=i-d)/o)-c)/2+20:(p=o*(r-(t.controls?t.icsize:0)-24),n&&(p-=24),s=p/o,20):(screenRatio=screen.width/screen.height,(e=screenRatio<o)?(p=(s=screen.height)*o,screen.width,m=0):(s=(p=screen.width)/o,m=(screen.height-s)/2,0)),h("#wppa-ovl-pan-container").css({marginTop:m}),h("#wppa-overlay-ic").css({marginTop:0}),t.canvasWidth=p,t.canvasHeight=s,t.canvas.width=t.canvasWidth,t.canvas.height=t.canvasHeight,n?(h("#wppa-ovl-pan-container").css({backgroundColor:t.backgroundColor,padding:t.padding,borderRadius:t.borderRadius,borderWidth:t.borderWidth,width:p,marginLeft:0}),h("#wppa-pctl-div-"+t.itemid).css({marginLeft:0}),e?h("#wppa-overlay-ic").css({left:4}):h("#wppa-overlay-ic").css({left:(i-p)/2})):(h("#wppa-overlay-ic").css({marginLeft:0}),h("#wppa-ovl-pan-container").css({backgroundColor:"transparent",padding:0,borderRadius:0,borderWidth:0,width:p,left:(i-p)/2,position:"fixed"}),h("#wppa-pctl-div-"+t.itemid).css({marginLeft:0}))):(t.canvasWidth=h(t.div).parent().width(),t.canvasHeight=t.canvasWidth/o,t.canvas.width=t.canvasWidth,t.canvas.height=t.canvasHeight),t.run=5,u(l))}}function f(a){a.preventDefault();var t,o=jQuery(this).attr("data-mocc");wppaZoomableData[o]&&(t=wppaZoomableData[o],wppaIsFs()&&(a.offsetX<t.fsMaskLeft||a.offsetX>t.fsMaskRight||a.offsetY<t.fsMaskTop||a.offsetY>t.fsMaskBottom)&&jQuery("#wppa-overlay-bg").trigger("click"),t.enableManual&&(t.manualControl=!0,t.savedCanvasX=a.offsetX,t.savedCanvasY=a.offsetY,t.run=5,u(o)))}function v(a){var t,o,e,n,i=jQuery(this).attr("data-mocc");!wppaZoomableData[i]||(t=wppaZoomableData[i]).manualControl&&(o=t.canvas.width/t.fromWidth,e=(t.savedCanvasX-a.offsetX)/o+t.fromX,n=(t.savedCanvasY-a.offsetY)/o+t.fromY,0<e&&0<n&&e+t.fromWidth<t.image.width&&n+t.fromHeight<t.image.height&&(t.fromX=e,t.fromY=n,t.savedCanvasX=a.offsetX,t.savedCanvasY=a.offsetY))}function g(a){var t,o=jQuery(this).attr("data-mocc");!wppaZoomableData[o]||(t=wppaZoomableData[o]).manualControl&&(t.run=4,t.manualControl=!1)}a?setTimeout(function(){wppaDoZoomPan()},300):h("#wppa-ovl-spin").hide()}
|
wppa.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
* Plugin Name: WP Photo Album Plus
|
4 |
* Description: Easily manage and display your photo albums and slideshows within your WordPress site.
|
5 |
-
* Version: 7.5.07.
|
6 |
* Author: J.N. Breetvelt a.k.a. OpaJaap
|
7 |
* Author URI: http://wppa.opajaap.nl/
|
8 |
* Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
|
@@ -24,7 +24,7 @@ global $wp_version;
|
|
24 |
|
25 |
/* WPPA GLOBALS */
|
26 |
global $wppa_revno; $wppa_revno = '7507'; // WPPA db version
|
27 |
-
global $wppa_api_version; $wppa_api_version = '7.5.07.
|
28 |
|
29 |
/* Init page js data */
|
30 |
global $wppa_js_page_data; $wppa_js_page_data = '';
|
2 |
/*
|
3 |
* Plugin Name: WP Photo Album Plus
|
4 |
* Description: Easily manage and display your photo albums and slideshows within your WordPress site.
|
5 |
+
* Version: 7.5.07.002
|
6 |
* Author: J.N. Breetvelt a.k.a. OpaJaap
|
7 |
* Author URI: http://wppa.opajaap.nl/
|
8 |
* Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
|
24 |
|
25 |
/* WPPA GLOBALS */
|
26 |
global $wppa_revno; $wppa_revno = '7507'; // WPPA db version
|
27 |
+
global $wppa_api_version; $wppa_api_version = '7.5.07.002'; // WPPA software version
|
28 |
|
29 |
/* Init page js data */
|
30 |
global $wppa_js_page_data; $wppa_js_page_data = '';
|