From 20d25afed657f405060b125d3c70c4a501647559 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Thu, 27 Sep 2018 19:27:24 +0200 Subject: [PATCH] Firefox zoom support check --- .../warppi/gui/graphicengine/html/HtmlEngine.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/teavm/src/main/java/it/cavallium/warppi/gui/graphicengine/html/HtmlEngine.java b/teavm/src/main/java/it/cavallium/warppi/gui/graphicengine/html/HtmlEngine.java index 8a4d65bb..faf66005 100644 --- a/teavm/src/main/java/it/cavallium/warppi/gui/graphicengine/html/HtmlEngine.java +++ b/teavm/src/main/java/it/cavallium/warppi/gui/graphicengine/html/HtmlEngine.java @@ -92,9 +92,14 @@ public class HtmlEngine implements GraphicEngine { }); onZoom.subscribe((windowZoom) -> { if (windowZoom != 0) { - canvas.setWidth((int)(480 / 1)); - canvas.setHeight((int)(320 / 1)); - canvas.getStyle().setProperty("zoom", "" + (windowZoom + 1)); + if (suppportsZoom()) { + canvas.setWidth((int)(480 / 1)); + canvas.setHeight((int)(320 / 1)); + canvas.getStyle().setProperty("zoom", "" + (windowZoom + 1)); + } else { + canvas.setWidth((int)(480 / (windowZoom + 1))); + canvas.setHeight((int)(320 / (windowZoom + 1))); + } canvas.getStyle().setProperty("max-height", (int)(44 / windowZoom) + "vh"); width = 480 / windowZoom.intValue(); height = 320 / windowZoom.intValue(); @@ -199,6 +204,9 @@ public class HtmlEngine implements GraphicEngine { onInitialized.run(); } + @JSBody(params = {}, script = "return CSS.supports(\"zoom:2\")") + private native boolean suppportsZoom(); + @Override public int getWidth() { if (width == -1)