Firefox zoom support check

This commit is contained in:
Andrea Cavalli 2018-09-27 19:27:24 +02:00
parent 5a65086421
commit 20d25afed6
1 changed files with 11 additions and 3 deletions

View File

@ -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)