v3.2.4: adjusted iOS safe inset sizes
This commit is contained in:
committed by
Evan Debenham
parent
b142589b04
commit
88a59ff342
@@ -62,25 +62,22 @@ public class IOSPlatformSupport extends PlatformSupport {
|
||||
public RectF getSafeInsets(int level) {
|
||||
RectF insets = super.getSafeInsets(INSET_ALL);
|
||||
|
||||
//magic number BS for larger status bar caused by dynamic island
|
||||
boolean hasDynamicIsland = insets.top / Gdx.graphics.getBackBufferScale() >= 51;
|
||||
|
||||
//iOS gives us ALL insets by default, and so we need to filter from there:
|
||||
|
||||
//ignore the home indicator if we're in fullscreen
|
||||
if (!supportsFullScreen() || SPDSettings.fullscreen()){
|
||||
insets.bottom = 0;
|
||||
} else {
|
||||
//otherwise bottom inset is pretty big, halve it
|
||||
insets.bottom /= 2;
|
||||
}
|
||||
|
||||
//only cutouts can be on top/left/right, which are never blocking
|
||||
if (level == INSET_BLK){
|
||||
insets.left = insets.top = insets.right = 0;
|
||||
} else if (level == INSET_LRG){
|
||||
//Dynamic Island counts as a 'small cutout', we have to use status bar height to get it =I
|
||||
double statusBarHeight = insets.top / Gdx.graphics.getBackBufferScale();
|
||||
if (statusBarHeight >= 51){ //magic number BS for larger status bar caused by island
|
||||
insets.left = insets.top = insets.right = 0;
|
||||
}
|
||||
} else if (level == INSET_LRG && hasDynamicIsland){
|
||||
//Dynamic Island counts as a 'small cutout'
|
||||
insets.left = insets.top = insets.right = 0;
|
||||
}
|
||||
|
||||
//if we are in landscape, the display cutout is only actually on one side, so cancel the other
|
||||
@@ -92,6 +89,12 @@ public class IOSPlatformSupport extends PlatformSupport {
|
||||
}
|
||||
}
|
||||
|
||||
//finally iOS is very conservative with these insets, we can shrink them a bit.
|
||||
insets.top /= hasDynamicIsland ? 1.2f : 1.4f;
|
||||
insets.left /= hasDynamicIsland ? 1.2f : 1.4f;
|
||||
insets.right /= hasDynamicIsland ? 1.2f : 1.4f;
|
||||
insets.bottom /= 2; //home bar inset is especially big for no reason
|
||||
|
||||
return insets;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user