Commit 8ccaf9c4 authored by kenan's avatar kenan

fix click

parent 93677f44
......@@ -81,8 +81,8 @@ public class GameSize {
public GameSize(int width, int height, int touchX, int touchY) {
this.width = width;
this.height = height;
this.touchX = touchX;
this.touchY = touchY;
this.touchX = touchX < 0 ? 0 : touchX;
this.touchY = touchY < 0 ? 0 : touchY;
}
@Override
......
......@@ -16,6 +16,7 @@ import com.yuyh.library.imgsel.common.ImageLoader;
import cn.garymb.ygomobile.interfaces.GameConfig;
import cn.garymb.ygomobile.interfaces.GameHost;
import cn.garymb.ygomobile.utils.CrashHandler;
import cn.garymb.ygomobile.utils.ScreenUtil;
import libwindbot.windbot.WindBot;
public class App extends GameApplication {
......
......@@ -141,7 +141,8 @@ class LocalGameHost extends GameHost {
}
maxW = Math.max(w1, h1);
maxH = Math.min(w1, h1);
if(immerSiveMode){
boolean hasNotouch = ScreenUtil.hasNotchInformation(activity);
if(hasNotouch && immerSiveMode){
maxW -= config.getNotouchHeight();
}
Log.i("kk", "real=" + fullW + "x" + fullH + ",cur=" + actW + "x" + actH + ",use=" + maxW + "x" + maxH);
......@@ -161,7 +162,7 @@ class LocalGameHost extends GameHost {
//fix touch point
int left = (maxW - gw) / 2;
int top = (maxH - gh) / 2;
if(!immerSiveMode){
if(hasNotouch && !immerSiveMode){
//fix touch
left = (maxW - gw - config.getNotouchHeight()) / 2;
}
......
......@@ -46,7 +46,11 @@ public class ScreenUtil {
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
DisplayCutout cutout = activity.getWindow().getDecorView().getRootWindowInsets().getDisplayCutout();
return cutout != null;
if (cutout == null) {
return false;
}
List<Rect> rects = cutout.getBoundingRects();
return rects != null && rects.size() > 0;
} else {
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment