comparison client/digitallibrary/jquery/jquery.digilib.js @ 884:80a695f683c7 jquery

trying to fix getFullscreenImgSize for iPad.
author robcast
date Tue, 22 Mar 2011 18:33:52 +0100
parents b2ec8244b86e
children 65ad22044e13
comparison
equal deleted inserted replaced
882:07926f0b9a1a 884:80a695f683c7
246 'imagePath' : 'img/embedded/16/', 246 'imagePath' : 'img/embedded/16/',
247 'standardSet' : ["reference","zoomin","zoomout","zoomarea","zoomfull","help","reset","toggleoptions"], 247 'standardSet' : ["reference","zoomin","zoomout","zoomarea","zoomfull","help","reset","toggleoptions"],
248 'specialSet' : ["mark","delmark","hmir","vmir","rot","brgt","cont","rgb","quality","scale","lessoptions"], 248 'specialSet' : ["mark","delmark","hmir","vmir","rot","brgt","cont","rgb","quality","scale","lessoptions"],
249 'arrowSet' : ["up", "down", "left", "right"], 249 'arrowSet' : ["up", "down", "left", "right"],
250 'buttonSets' : ['standardSet', 'specialSet'] 250 'buttonSets' : ['standardSet', 'specialSet']
251 }, 251 }
252 }, 252 },
253 // arrow bar overlays for moving the zoomed area 253 // arrow bar overlays for moving the zoomed area
254 'showZoomArrows' : true, 254 'showZoomArrows' : true,
255 // zoom arrow bar minimal width (for small images) 255 // zoom arrow bar minimal width (for small images)
256 'zoomArrowMinWidth' : 6, 256 'zoomArrowMinWidth' : 6,
963 // returns maximum size for scaler img in fullscreen mode 963 // returns maximum size for scaler img in fullscreen mode
964 var getFullscreenImgSize = function (data) { 964 var getFullscreenImgSize = function (data) {
965 var $win = $(window); 965 var $win = $(window);
966 var winH = $win.height(); 966 var winH = $win.height();
967 var winW = $win.width(); 967 var winW = $win.width();
968 console.debug("window size="+winW+"x"+winH);
968 var $body = $('body'); 969 var $body = $('body');
969 // include standard body margins 970 // include standard body margins
970 var borderW = $body.outerWidth(true) - $body.width(); 971 var borderW = $body.outerWidth(true) - $body.width();
971 var borderH = $body.outerHeight(true) - $body.height(); 972 var borderH = $body.outerHeight(true) - $body.height();
973 console.debug("body outerwidth="+$body.outerWidth(true)+" width="+$body.width());
972 // get width of first button div 974 // get width of first button div
973 var buttonsW = 0; 975 var buttonsW = 0;
974 if (data.$buttonSets) { 976 if (data.$buttonSets) {
975 buttonsW = data.$buttonSets[0].outerWidth(); 977 buttonsW = data.$buttonSets[0].outerWidth();
978 // try to fix ipad...
979 if (buttonsW === $body.width()) {
980 console.error("buttons width can't be measured -- using 32");
981 buttonsW = 32;
982 }
976 } 983 }
977 // account for left/right border, body margins and additional requirements 984 // account for left/right border, body margins and additional requirements
978 var calcW = winW - borderW - buttonsW - data.settings.scalerInset; 985 var calcW = winW - borderW - buttonsW - data.settings.scalerInset;
979 var calcH = winH - borderH; 986 var calcH = winH - borderH;
987 console.debug("calcw="+calcW+" buttonsw="+buttonsW+" inset="+data.settings.scalerInset+" calcH="+calcH);
980 console.debug(winW, winH, 'winW:', $win.width(), 'border:', borderW, 'buttonsW:', buttonsW, 'calc:', calcW); 988 console.debug(winW, winH, 'winW:', $win.width(), 'border:', borderW, 'buttonsW:', buttonsW, 'calc:', calcW);
981 return geom.size(calcW, calcH); 989 return geom.size(calcW, calcH);
982 }; 990 };
983 991
984 // creates HTML structure for digilib in elem 992 // creates HTML structure for digilib in elem
1166 rect : geom.rectangle(r.x, r.y + r.height - aw, r.width, aw), 1174 rect : geom.rectangle(r.x, r.y + r.height - aw, r.width, aw),
1167 show : canMove(data, 0, 1) 1175 show : canMove(data, 0, 1)
1168 }, { 1176 }, {
1169 name : 'left', 1177 name : 'left',
1170 rect : geom.rectangle(r.x, r.y, aw, r.height), 1178 rect : geom.rectangle(r.x, r.y, aw, r.height),
1171 show : canMove(data, -1, 0), 1179 show : canMove(data, -1, 0)
1172 }, { 1180 }, {
1173 name : 'right', 1181 name : 'right',
1174 rect : geom.rectangle(r.x + r.width - aw, r.y, aw, r.height), 1182 rect : geom.rectangle(r.x + r.width - aw, r.y, aw, r.height),
1175 show : canMove(data, 1, 0) 1183 show : canMove(data, 1, 0)
1176 }]; 1184 }];
1703 var x2 = za.x + za.width; 1711 var x2 = za.x + za.width;
1704 var y2 = za.y + za.height; 1712 var y2 = za.y + za.height;
1705 return ((movx < 0) && (za.x > 0)) 1713 return ((movx < 0) && (za.x > 0))
1706 || ((movx > 0) && (x2 < 1.0)) 1714 || ((movx > 0) && (x2 < 1.0))
1707 || ((movy < 0) && (za.y > 0)) 1715 || ((movy < 0) && (za.y > 0))
1708 || ((movy > 0) && (y2 < 1.0)) 1716 || ((movy > 0) && (y2 < 1.0));
1709 }; 1717 };
1710 1718
1711 // auxiliary function (from old dllib.js) 1719 // auxiliary function (from old dllib.js)
1712 var isFullArea = function (area) { 1720 var isFullArea = function (area) {
1713 return (area.width === 1.0) && (area.height === 1.0); 1721 return (area.width === 1.0) && (area.height === 1.0);