Initial commit
This commit is contained in:
43
sources/com/ubt/jimu/controller/util/AdsorbUtils.java
Normal file
43
sources/com/ubt/jimu/controller/util/AdsorbUtils.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.ubt.jimu.controller.util;
|
||||
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.RectF;
|
||||
import android.util.Size;
|
||||
import com.ubtech.utils.XLog;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AdsorbUtils {
|
||||
public static PointF a(float f, float f2, float f3) {
|
||||
int round = Math.round(f2 / f);
|
||||
int round2 = Math.round(f3 / f);
|
||||
float f4 = round * f;
|
||||
float f5 = round2 * f;
|
||||
XLog.a("Controller", "row: %d, column: %d (%.3f, %.3f) -> (%.3f, %.3f)", Integer.valueOf(round), Integer.valueOf(round2), Float.valueOf(f2), Float.valueOf(f3), Float.valueOf(f4), Float.valueOf(f5));
|
||||
return new PointF(f4, f5);
|
||||
}
|
||||
|
||||
public static PointF a(float f, Size size, float f2, float f3, RectF rectF) {
|
||||
if (rectF != null) {
|
||||
int round = Math.round(f2 / f);
|
||||
int round2 = Math.round(f3 / f);
|
||||
float f4 = round * f;
|
||||
float width = rectF.width() / 2.0f;
|
||||
if (f4 + width > size.getWidth()) {
|
||||
f4 = ((float) (round - Math.ceil((r5 - size.getWidth()) / f))) * f;
|
||||
} else if (f4 - width < 0.0f) {
|
||||
f4 = width;
|
||||
}
|
||||
float f5 = round2 * f;
|
||||
if ((rectF.height() / 2.0f) + f5 > size.getHeight()) {
|
||||
f5 = ((float) (round2 - Math.ceil((r11 - size.getHeight()) / f))) * f;
|
||||
}
|
||||
XLog.a("Controller", "(%.3f, %.3f) adsorb to -> (%.3f, %.3f)", Float.valueOf(f2), Float.valueOf(f3), Float.valueOf(f4), Float.valueOf(f5));
|
||||
return new PointF(f4, f5);
|
||||
}
|
||||
return new PointF(f2, f3);
|
||||
}
|
||||
|
||||
public static boolean a(RectF rectF, RectF rectF2) {
|
||||
return ((int) rectF.left) < ((int) rectF2.right) && ((int) rectF2.left) < ((int) rectF.right) && ((int) rectF.top) < ((int) rectF2.bottom) && ((int) rectF2.top) < ((int) rectF.bottom);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user