From d1d963052f454bff4f7349c2e2f76ae0e6ee59ad Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Wed, 18 Nov 2015 23:27:25 +0100 Subject: [PATCH] Fix webview height --- .../java/io/bitsquare/gui/popups/WebViewPopup.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gui/src/main/java/io/bitsquare/gui/popups/WebViewPopup.java b/gui/src/main/java/io/bitsquare/gui/popups/WebViewPopup.java index 21b43be740..d047e795f3 100644 --- a/gui/src/main/java/io/bitsquare/gui/popups/WebViewPopup.java +++ b/gui/src/main/java/io/bitsquare/gui/popups/WebViewPopup.java @@ -51,15 +51,22 @@ public class WebViewPopup extends Popup { Utilities.setupWebViewPopupHandler(webView.getEngine()); webView.getEngine().documentProperty().addListener((observable, oldValue, newValue) -> { + // TODO At linux the heightInPx is screwed up.... need to find a better solution that that ugly html hack String heightInPx = webView.getEngine() .executeScript("window.getComputedStyle(document.body, null).getPropertyValue('height')").toString(); - double height = Math.min(Double.valueOf(heightInPx.replace("px", "")) * 1.2, BitsquareApp.getPrimaryStage().getHeight()); - webView.setPrefHeight(height); - stage.setMinHeight(height + gridPane.getHeight()); + double webViewHeight = Math.min(Double.valueOf(heightInPx.replace("px", "")) * 1.2, + BitsquareApp.getPrimaryStage().getHeight() - 200); + double stageHeight = Math.min(webViewHeight + gridPane.getHeight(), + BitsquareApp.getPrimaryStage().getHeight()); + webView.setPrefHeight(webViewHeight); + stage.setMinHeight(stageHeight); + stage.setMaxHeight(stageHeight); centerPopup(); + gridPane.setVisible(true); }); createGridPane(); + gridPane.setVisible(false); addHtmlContent(); createPopup(); return this;