Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 140 → Rev 145

/trunk/src/org/tela_botanica/client/vues/MiniZoomImageVue.java
479,7 → 479,7
// on ne fait rien
return;
}
 
/*
// on prend la taille originale de l'image
int originalX = getTailleImage()[0];
int originalY = getTailleImage()[1];
526,12 → 526,37
nouvelleTailleX = (int) Math.floor(nouvelleTailleY
* rapportTaille);
}
 
*/
// on modifie enfin la taille de l'image pour qu'elle soit affichée
getImage().setSize("" + nouvelleTailleX + "px",
"" + nouvelleTailleY + "px");
int[] dim = calculerDimensions(getTailleImage());
getImage().setSize("" + dim[0] + "px",
"" + dim[1] + "px");
doLayout();
}
public int[] calculerDimensions(int[] tailleXY) {
Window.alert("largueur : "+tailleXY[0]+" longueur : "+tailleXY[1]);
float[] tailleXYf = {new Float(tailleXY[0]),new Float(tailleXY[1])} ;
float tailleOr = Math.min(300,imageConteneur.getWidth()) ;
float maxTaille = Math.max(tailleXYf[1],tailleXYf[0]) ;
float[] XYresize = new float[2];
if(maxTaille == tailleXY[0]) {
float rapport = tailleXYf[1]/tailleXYf[0] ;
XYresize[0] = tailleOr ;
XYresize[1] = tailleOr*rapport ;
}else {
float rapport = tailleXYf[0]/tailleXYf[1] ;
XYresize[1] = tailleOr ;
XYresize[0] = tailleOr*rapport ;
}
int[] res = {Math.round(XYresize[0]),Math.round(XYresize[1])} ;
return res;
}
}