Skip to content

Commit

Permalink
Added a 500ms subsequent update of safe area insets (workaround for i…
Browse files Browse the repository at this point in the history
…Pad bug)
  • Loading branch information
salmonb committed Aug 29, 2024
1 parent 85d22b0 commit 3ab658c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import dev.webfx.kit.mapper.peers.javafxgraphics.gwtj2cl.util.HtmlUtil;
import dev.webfx.kit.util.properties.FXProperties;
import dev.webfx.platform.console.Console;
import dev.webfx.platform.uischeduler.UiScheduler;
import dev.webfx.platform.useragent.UserAgent;
import dev.webfx.platform.util.Numbers;
import dev.webfx.platform.util.Strings;
Expand Down Expand Up @@ -264,6 +265,9 @@ public ReadOnlyObjectProperty<Insets> safeAreaInsetsProperty() {
safeAreaInsetsProperty = new SimpleObjectProperty<>(Insets.EMPTY);
FXProperties.runNowAndOnPropertiesChange(this::updateSafeAreaInsets,
getPrimaryStage().widthProperty(), getPrimaryStage().heightProperty());
// Workaround for a bug observed in the Gmail internal browser on iPad where the window width/height
// are still not final at the first opening. So we schedule a subsequent update to get final values.
UiScheduler.scheduleDelay(500, this::updateSafeAreaInsets); // 500ms seem enough
}
return safeAreaInsetsProperty;
}
Expand Down

0 comments on commit 3ab658c

Please sign in to comment.