termites 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.js +15 -6
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1085,17 +1085,24 @@ class TermitesServer {
|
|
|
1085
1085
|
}));
|
|
1086
1086
|
}
|
|
1087
1087
|
}
|
|
1088
|
+
function isMobileDevice() {
|
|
1089
|
+
return 'ontouchstart' in window || navigator.maxTouchPoints > 0 ||
|
|
1090
|
+
/Mobile|Android|iPhone|iPad|iPod|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
1091
|
+
}
|
|
1088
1092
|
function handleViewportResize() {
|
|
1089
|
-
//
|
|
1090
|
-
if (window.visualViewport) {
|
|
1093
|
+
// Only adjust body height on mobile devices (handles keyboard popup)
|
|
1094
|
+
if (isMobileDevice() && window.visualViewport) {
|
|
1091
1095
|
const vh = window.visualViewport.height;
|
|
1092
1096
|
document.body.style.height = vh + 'px';
|
|
1093
1097
|
// Scroll viewport to top to prevent offset issues
|
|
1094
1098
|
window.scrollTo(0, 0);
|
|
1099
|
+
} else {
|
|
1100
|
+
// On desktop, use full viewport height
|
|
1101
|
+
document.body.style.height = '';
|
|
1095
1102
|
}
|
|
1096
1103
|
handleResize();
|
|
1097
1104
|
}
|
|
1098
|
-
window.addEventListener('resize',
|
|
1105
|
+
window.addEventListener('resize', handleViewportResize);
|
|
1099
1106
|
window.addEventListener('orientationchange', () => {
|
|
1100
1107
|
// Delay fit after orientation change to let browser settle
|
|
1101
1108
|
setTimeout(handleViewportResize, 100);
|
|
@@ -1103,10 +1110,12 @@ class TermitesServer {
|
|
|
1103
1110
|
// Also handle visual viewport changes (mobile keyboard show/hide)
|
|
1104
1111
|
if (window.visualViewport) {
|
|
1105
1112
|
window.visualViewport.addEventListener('resize', handleViewportResize);
|
|
1106
|
-
window.visualViewport.addEventListener('scroll', () =>
|
|
1107
|
-
|
|
1108
|
-
|
|
1113
|
+
window.visualViewport.addEventListener('scroll', () => {
|
|
1114
|
+
if (isMobileDevice()) window.scrollTo(0, 0);
|
|
1115
|
+
});
|
|
1109
1116
|
}
|
|
1117
|
+
// Initial adjustment
|
|
1118
|
+
handleViewportResize();
|
|
1110
1119
|
connect();
|
|
1111
1120
|
applyTheme(currentTheme);
|
|
1112
1121
|
}
|