Add cordova device plugin and zoom in home page
The user can now zoom in/out the network graph in the home page with two buttons. Added the cordova device plugin to detect when the phone is ready and the change the behavior of the backbutton on android. Disabled the panel left swipe because of some scroll problems in landscape mode.
This commit is contained in:
@ -95,3 +95,33 @@ function displayCharacters() {
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
function onDeviceReady() {
|
||||
const container = document.getElementById("container-characters");
|
||||
container.style.zoom = 1;
|
||||
|
||||
$$("#zoom-in").on("click", () => {
|
||||
let zoom = Number(container.style.zoom) + 0.25;
|
||||
container.style.zoom = zoom;
|
||||
app.range.setValue("#range-zoom", zoom);
|
||||
});
|
||||
$$("#zoom-out").on("click", () => {
|
||||
let zoom = Number(container.style.zoom) - 0.25;
|
||||
container.style.zoom = zoom;
|
||||
app.range.setValue("#range-zoom", zoom);
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("backbutton", onBackKeyDown, false);
|
||||
function onBackKeyDown() {
|
||||
if ($$('.panel').hasClass("panel-active")) {
|
||||
app.panel.close(".panel");
|
||||
} else if ($$('.modal-in').length > 0) {
|
||||
app.smartSelect.close("#select-compare"); // TODO: fix that
|
||||
} else if ($$('.back').length > 0) {
|
||||
mainView.router.back();
|
||||
} else {
|
||||
navigator.app.exitApp();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user