Firefox zoom support check

This commit is contained in:
Andrea Cavalli 2018-09-27 19:27:24 +02:00
parent 5a65086421
commit 20d25afed6

View File

@ -92,9 +92,14 @@ public class HtmlEngine implements GraphicEngine {
}); });
onZoom.subscribe((windowZoom) -> { onZoom.subscribe((windowZoom) -> {
if (windowZoom != 0) { if (windowZoom != 0) {
if (suppportsZoom()) {
canvas.setWidth((int)(480 / 1)); canvas.setWidth((int)(480 / 1));
canvas.setHeight((int)(320 / 1)); canvas.setHeight((int)(320 / 1));
canvas.getStyle().setProperty("zoom", "" + (windowZoom + 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"); canvas.getStyle().setProperty("max-height", (int)(44 / windowZoom) + "vh");
width = 480 / windowZoom.intValue(); width = 480 / windowZoom.intValue();
height = 320 / windowZoom.intValue(); height = 320 / windowZoom.intValue();
@ -199,6 +204,9 @@ public class HtmlEngine implements GraphicEngine {
onInitialized.run(); onInitialized.run();
} }
@JSBody(params = {}, script = "return CSS.supports(\"zoom:2\")")
private native boolean suppportsZoom();
@Override @Override
public int getWidth() { public int getWidth() {
if (width == -1) if (width == -1)