Skip to content

Commit 0de80f7

Browse files
committed
[fix] correct rendering on iPhone, fixes #73
1 parent 4bc2829 commit 0de80f7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

map_ex/views/widget.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,17 @@
214214
function getMapZoom<?php echo $map_id2;?>(){
215215
if (window.outerWidth<=767) {
216216
var orientation = screen.orientation || screen.mozOrientation || screen.msOrientation || null;
217-
var landscape = (typeof orientation === 'object' && typeof orientation.type === 'string') ? (orientation.type.indexOf("landscape") >= 0) : (Math.abs(Number(window.orientation)) === 90);
217+
var landscape = false;
218+
if (typeof orientation === 'object' && orientation && typeof orientation.type === 'string') {
219+
landscape = (orientation.type.indexOf("landscape") >= 0);
220+
}
221+
else {
222+
if (typeof window.orientation !== "undefined") {
223+
landscape = (Math.abs(Number(window.orientation)) === 90);
224+
}
225+
else
226+
landscape = (window.innerWidth > window.innerHeight);
227+
}
218228
if (landscape) {
219229
<?php if ($settings['debug_output']) : ?>
220230
console.info('<?php echo '[' . $info['name'] . '] ';?>Detected Phone Landscape mode');

0 commit comments

Comments
 (0)