@@ -231,8 +231,8 @@ protected void disposeEvent(MotionEvent e) {
231
231
232
232
@ Override
233
233
public void setImageBitmap (Bitmap bm ) {
234
- setWidthHeightRatio ((float ) parentWidth * 1f / (float ) bm .getWidth (), (float ) parentHeight * 1f / (float ) bm .getHeight ());
235
234
super .setImageBitmap (bm );
235
+ calculateWidthHeightRatio ();
236
236
}
237
237
238
238
// ============================@Set/Get@============================
@@ -241,9 +241,9 @@ public void setParentWidthHeight(int width, int height) {
241
241
parentHeight = height ;
242
242
}
243
243
244
- public void setWidthHeightRatio ( float widthRatio , float heightRatio ) {
245
- this . widthRatio = widthRatio ;
246
- this . heightRatio = heightRatio ;
244
+ public void calculateWidthHeightRatio ( ) {
245
+ widthRatio = ( float ) parentWidth / getDrawable (). getIntrinsicWidth () ;
246
+ heightRatio = ( float ) parentHeight / getDrawable (). getIntrinsicHeight () ;
247
247
}
248
248
249
249
public void setCurrentClickAnchor (Anchor anchor ) {
@@ -383,10 +383,10 @@ class AnchorCutProcess extends Thread {
383
383
384
384
rectClickAnchor .set (leftP * widthRatio , topP * heightRatio , rightP * widthRatio , bottomP * heightRatio );
385
385
386
- leftDMovElement = leftD * 1f / diffMovElementTotal ;
387
- rightDMovElement = rightD * 1f / diffMovElementTotal ;
388
- topDMovElement = topD * 1f / diffMovElementTotal ;
389
- bottomDMovElement = bottomD * 1f / diffMovElementTotal ;
386
+ leftDMovElement = leftD / diffMovElementTotal ;
387
+ rightDMovElement = rightD / diffMovElementTotal ;
388
+ topDMovElement = topD / diffMovElementTotal ;
389
+ bottomDMovElement = bottomD / diffMovElementTotal ;
390
390
}
391
391
392
392
public void run () {
0 commit comments