Mercurial > hg > digilib-old
diff client/digitallibrary/jquery/jquery.digilib.regions.js @ 852:4658ec2f9565 jquery
why not use coords attribute for coords?
author | hertzhaft |
---|---|
date | Mon, 07 Mar 2011 09:54:36 +0100 |
parents | 5922c444cd11 |
children | 2c401f68d577 |
line wrap: on
line diff
--- a/client/digitallibrary/jquery/jquery.digilib.regions.js Mon Mar 07 09:30:55 2011 +0100 +++ b/client/digitallibrary/jquery/jquery.digilib.regions.js Mon Mar 07 09:54:36 2011 +0100 @@ -239,10 +239,9 @@ console.debug("createRegionsFromHTML. elems: ", $content); $content.each(function(index, a) { var $a = $(a); - // the "rel" attribute contains the region coords - var rel = $a.attr('rel'); - var area = rel.replace(/^area:/i, ''); - var pos = area.split("/", 4); + // the "coords" attribute contains the region coords (0..1) + var coords = $a.attr('coords'); + var pos = coords.split(",", 4); var rect = geom.rectangle(pos[0], pos[1], pos[2], pos[3]); regions.push(rect); // create the div @@ -300,10 +299,10 @@ var rg = data.settings.rg; if (rg == null) return; var regions = data.regions; - var rs = rg.split(","); + var rs = rg.split(";"); for (var i = 0; i < rs.length; i++) { var r = rs[i]; - var pos = r.split("/", 4); + var pos = r.split(",", 4); var rect = geom.rectangle(pos[0], pos[1], pos[2], pos[3]); regions.push(rect); } @@ -320,14 +319,14 @@ for (var i = 0; i < regions.length; i++) { region = regions[i]; if (i) { - rg += ','; + rg += ';'; } rg += [ fn.cropFloatStr(region.x), fn.cropFloatStr(region.y), fn.cropFloatStr(region.width), fn.cropFloatStr(region.height) - ].join('/'); + ].join(','); } data.settings.rg = rg; };