mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-19 12:24:19 -04:00
Add fix for centering for all OS
This commit is contained in:
parent
e5faad5d05
commit
12b7555c66
1 changed files with 16 additions and 19 deletions
|
@ -100,10 +100,8 @@ public class Popup {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hide() {
|
public void hide() {
|
||||||
if (Utilities.isLinux() && owner != null && positionListener != null) {
|
|
||||||
owner.getScene().getWindow().xProperty().removeListener(positionListener);
|
owner.getScene().getWindow().xProperty().removeListener(positionListener);
|
||||||
owner.getScene().getWindow().yProperty().removeListener(positionListener);
|
owner.getScene().getWindow().yProperty().removeListener(positionListener);
|
||||||
}
|
|
||||||
|
|
||||||
if (centerTime != null)
|
if (centerTime != null)
|
||||||
centerTime.cancel();
|
centerTime.cancel();
|
||||||
|
@ -255,10 +253,10 @@ public class Popup {
|
||||||
|
|
||||||
MainView.blurLight();
|
MainView.blurLight();
|
||||||
|
|
||||||
if (Utilities.isLinux()) {
|
|
||||||
// On Linux the owner stage does not move the child stage as it does on Mac
|
// On Linux the owner stage does not move the child stage as it does on Mac
|
||||||
// So we need to apply centerPopup. Further with fast movements the handler loses
|
// So we need to apply centerPopup. Further with fast movements the handler loses
|
||||||
// the latest position, with a delay it fixes that.
|
// the latest position, with a delay it fixes that.
|
||||||
|
// Also on Mac sometimes the popups are positioned outside of the main app, so keep it for all OS
|
||||||
positionListener = (observable, oldValue, newValue) -> {
|
positionListener = (observable, oldValue, newValue) -> {
|
||||||
if (stage != null) {
|
if (stage != null) {
|
||||||
centerPopup();
|
centerPopup();
|
||||||
|
@ -271,7 +269,6 @@ public class Popup {
|
||||||
owner.getScene().getWindow().xProperty().addListener(positionListener);
|
owner.getScene().getWindow().xProperty().addListener(positionListener);
|
||||||
owner.getScene().getWindow().yProperty().addListener(positionListener);
|
owner.getScene().getWindow().yProperty().addListener(positionListener);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected void centerPopup() {
|
protected void centerPopup() {
|
||||||
Window window = owner.getScene().getWindow();
|
Window window = owner.getScene().getWindow();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue