# HG changeset patch # User hertzhaft # Date 1299627557 -3600 # Node ID 7ebdc106a61ace189d41df7919f8c667d10584fe # Parent 5795b9cae183c4dd653eac94f93f81c9b4afbbee second step towards zoom arrows diff -r 5795b9cae183 -r 7ebdc106a61a client/digitallibrary/jquery/jquery-test-full.html --- a/client/digitallibrary/jquery/jquery-test-full.html Tue Mar 08 09:07:07 2011 +0100 +++ b/client/digitallibrary/jquery/jquery-test-full.html Wed Mar 09 00:39:17 2011 +0100 @@ -86,11 +86,13 @@
DEBUG
+ diff -r 5795b9cae183 -r 7ebdc106a61a client/digitallibrary/jquery/jquery.digilib.css --- a/client/digitallibrary/jquery/jquery.digilib.css Tue Mar 08 09:07:07 2011 +0100 +++ b/client/digitallibrary/jquery/jquery.digilib.css Wed Mar 09 00:39:17 2011 +0100 @@ -126,6 +126,17 @@ margin-bottom: 20px; } +div.arrow { + position: absolute; + text-align: center; + background-color: black; + opacity: 0.08; +} + +div.arrow:hover { + opacity: 0.5; +} + /* special definitions for fullscreen */ div.digilib.dl_fullscreen div.buttons { position: fixed; diff -r 5795b9cae183 -r 7ebdc106a61a client/digitallibrary/jquery/jquery.digilib.js --- a/client/digitallibrary/jquery/jquery.digilib.js Tue Mar 08 09:07:07 2011 +0100 +++ b/client/digitallibrary/jquery/jquery.digilib.js Wed Mar 09 00:39:17 2011 +0100 @@ -231,7 +231,7 @@ // arrow overlays for moving the zoomed area 'zoomArrows' : true, // zoom arrow image info - 'zoomArrowImg' : { + 'zoomArrowsInfo' : { // path to arrow images (must end with a slash) 'imagePath' : 'img/', // minimal width of the arrow bar (pixel) @@ -928,6 +928,7 @@ updateImgTrafo(data); renderMarks(data); setupZoomDrag(data); + renderZoomArrows(data); // send event $(data).trigger('update'); }; @@ -1078,8 +1079,53 @@ var show = settings.zoomArrows; console.log('zoom arrows:', show); if (!show) return; + data.$arrows = {}; + var $arrows = data.$arrows; + var info = settings.zoomArrowsInfo; + $.each(['up','down','left','right'], function(i, s){ + var src = info.imagePath + info[s]; + var $div = $('
'); + var $img = $(''); + $div.attr('title', s); + $img.attr('alt', s); + $div.append($img); + $elem.append($div); + $arrows[s] = $div; + }); + $arrows.up.bind('click.digilib', function(event) { + //za.addPosition(delta.neg()); + // transform back + // var newArea = data.imgTrafo.invtransform(za); + // data.zoomArea = FULL_AREA.fit(newArea); + redisplay(data); + }); + $arrows.down.bind('click.digilib', function(event) { + redisplay(data); + }); + $arrows.left.bind('click.digilib', function(event) { + redisplay(data); + }); + $arrows.right.bind('click.digilib', function(event) { + redisplay(data); + }); }; + // size and show arrow overlays, called after scaler img is loaded + var renderZoomArrows = function (data) { + var $arrows = data.$arrows; + var r = FULL_AREA.copy(); + r.height = 0.05; + data.imgTrafo.transform(r).adjustDiv($arrows.up); + r.y = 0.95; + data.imgTrafo.transform(r).adjustDiv($arrows.down); + r = FULL_AREA.copy(); + r.width = 0.05; + data.imgTrafo.transform(r).adjustDiv($arrows.left); + r.x = 0.95; + data.imgTrafo.transform(r).adjustDiv($arrows.right); + }; + + // creates HTML structure for the about view in elem var setupAboutDiv = function (data) { var $elem = data.$elem; diff -r 5795b9cae183 -r 7ebdc106a61a client/digitallibrary/jquery/jquery.digilib.regions.js --- a/client/digitallibrary/jquery/jquery.digilib.regions.js Tue Mar 08 09:07:07 2011 +0100 +++ b/client/digitallibrary/jquery/jquery.digilib.regions.js Wed Mar 09 00:39:17 2011 +0100 @@ -227,7 +227,7 @@ var regionInfoSVG = function (data) { var $infoDiv = $('
'); $.each(data.regions, function(index, r) { - var area = [r.x, r.y, r.width, r.height].join(' '); + var area = r.getAsSvg(); $infoDiv.append($('
').text('"' + area + '"')); }); return $infoDiv; @@ -237,7 +237,7 @@ var regionInfoDigilib = function (data) { var $infoDiv = $('
'); $.each(data.regions, function(index, r) { - var area = r.width + 'x' + r.height + '@' + r.x + ',' + r.y; + var area = r.toString(); $infoDiv.append($('
').text(area)); }); return $infoDiv;