react-fullscreenable
Version:
React higher order component that provides fullscreen API to the enhanced component
19 lines (18 loc) • 508 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getZoomLevel;
// Calculates the zoom level based on window.innerWidth
// accounts for rotation which affects the value of innerWidth.
function getZoomLevel() {
switch (window && window.orientation) {
case 0:
return window.innerWidth / screen.width;
case -90:
case 90:
return window.innerWidth / screen.height;
default:
return 1;
}
}