Author: nbelaevski
Date: 2008-08-21 09:47:11 -0400 (Thu, 21 Aug 2008)
New Revision: 10161
Modified:
trunk/samples/richfaces-demo/src/main/webapp/scripts/picturesUtils.js
Log:
https://jira.jboss.org/jira/browse/RF-4250
Modified: trunk/samples/richfaces-demo/src/main/webapp/scripts/picturesUtils.js
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/scripts/picturesUtils.js 2008-08-21
09:17:21 UTC (rev 10160)
+++ trunk/samples/richfaces-demo/src/main/webapp/scripts/picturesUtils.js 2008-08-21
13:47:11 UTC (rev 10161)
@@ -1,10 +1,19 @@
+function resize(id, coeff) {
+ var pic = document.getElementById(id);
+
+ var w = Math.round(pic.width * coeff);
+ var h = Math.round(pic.height * coeff);
+
+ if (w > 1 && h > 1) {
+ pic.width = w;
+ pic.heigth = h;
+ }
+}
+
function enlarge(id){
- var pic =document.getElementById(id);
- pic.width=document.getElementById(id).width*1.1;
- pic.height=document.getElementById(id).height*1.1;
+ resize(id, 1.1);
}
+
function decrease(id){
- var pic =document.getElementById(id);
- pic.width=document.getElementById(id).width*0.9;
- pic.height=document.getElementById(id).height*0.9;
+ resize(id, 0.9);
}