mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-13 20:29:24 +00:00
Merge pull request #9943 from keymanapp/fix/web/gestures-old-android-compat
fix(web): restores compat with older Android devices 🐵
This commit is contained in:
commit
eefea0d972
7 changed files with 38 additions and 13 deletions
|
|
@ -15,6 +15,7 @@
|
|||
polyfill.
|
||||
-->
|
||||
<script src="es6-shim.min.js"></script>
|
||||
<script src="other-polyfills.js"></script>
|
||||
<script src="keymanweb-webview.js"></script>
|
||||
<script src="sentry.min.js"></script>
|
||||
<script src="keyman-sentry.js"></script>
|
||||
|
|
|
|||
17
android/KMEA/app/src/main/assets/other-polyfills.js
Normal file
17
android/KMEA/app/src/main/assets/other-polyfills.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Needed by the KMW's gesture engine until Chrome 61.
|
||||
var DOMRect = DOMRect || function (x, y, width, height) {
|
||||
this.x = this.left = x;
|
||||
this.y = this.top = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.bottom = y + height;
|
||||
this.right = x + width;
|
||||
};
|
||||
|
||||
// https://stackoverflow.com/questions/53308396/how-to-polyfill-array-prototype-includes-for-ie8
|
||||
if(!Array.prototype.includes){
|
||||
//or use Object.defineProperty
|
||||
Array.prototype.includes = function(search){
|
||||
return !!~this.indexOf(search);
|
||||
}
|
||||
}
|
||||
|
|
@ -281,6 +281,7 @@ public final class KMManager {
|
|||
protected static final String KMFilename_KmwGlobeHintCss = "globe-hint.css";
|
||||
protected static final String KMFilename_Osk_Ttf_Font = "keymanweb-osk.ttf";
|
||||
protected static final String KMFilename_JSPolyfill = "es6-shim.min.js";
|
||||
protected static final String KMFilename_JSPolyfill2 = "other-polyfills.js";
|
||||
|
||||
// Deprecated by KeyboardController.KMFilename_Installed_KeyboardsList
|
||||
public static final String KMFilename_KeyboardsList = "keyboards_list.dat";
|
||||
|
|
@ -812,6 +813,7 @@ public final class KMManager {
|
|||
// Copy default keyboard font
|
||||
copyAsset(context, KMDefault_KeyboardFont, "", true);
|
||||
copyAsset(context, KMFilename_JSPolyfill, "", true);
|
||||
copyAsset(context, KMFilename_JSPolyfill2, "", true);
|
||||
|
||||
// Keyboard packages directory
|
||||
File packagesDir = new File(getPackagesDir());
|
||||
|
|
|
|||
|
|
@ -125,11 +125,11 @@ export class PaddedZoneSource implements RecognitionZoneSource {
|
|||
getBoundingClientRect(): DOMRect {
|
||||
const rootZone = this.root.getBoundingClientRect();
|
||||
|
||||
return DOMRect.fromRect({
|
||||
x: rootZone.x + this.edgePadding.x,
|
||||
y: rootZone.y + this.edgePadding.y,
|
||||
width: rootZone.width - this.edgePadding.w,
|
||||
height: rootZone.height - this.edgePadding.h
|
||||
});
|
||||
return new DOMRect(
|
||||
/*x:*/ rootZone.x + this.edgePadding.x,
|
||||
/*y:*/ rootZone.y + this.edgePadding.y,
|
||||
/*width:*/ rootZone.width - this.edgePadding.w,
|
||||
/*height:*/ rootZone.height - this.edgePadding.h
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,11 +5,11 @@ export class ViewportZoneSource implements RecognitionZoneSource {
|
|||
|
||||
getBoundingClientRect(): DOMRect {
|
||||
// Viewport dimension detection is based on https://stackoverflow.com/a/8876069.
|
||||
return DOMRect.fromRect({
|
||||
y: 0,
|
||||
x: 0,
|
||||
width: Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),
|
||||
height: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)
|
||||
});
|
||||
return new DOMRect(
|
||||
/*x:*/ 0,
|
||||
/*y:*/ 0,
|
||||
/*width:*/ Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),
|
||||
/*height:*/ Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -51,6 +51,9 @@ await esbuild.build(embeddedWorkerBuildOptions);
|
|||
const minifiedProfilingOptions = {
|
||||
...embeddedWorkerBuildOptions,
|
||||
minify: true,
|
||||
// Do NOT enable - will break under Android 5.0 / Chrome 35 environments, likely through Chrome 42.
|
||||
// https://caniuse.com/mdn-javascript_builtins_function_name_configurable_true
|
||||
keepNames: false,
|
||||
metafile: true,
|
||||
write: false // don't actually write the file.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ if(MINIFY) {
|
|||
sourcemap: 'external',
|
||||
sourcesContent: DEBUG,
|
||||
minify: true,
|
||||
keepNames: true,
|
||||
// Do NOT enable - will break under Android 5.0 / Chrome 35 environments, likely through Chrome 42.
|
||||
// https://caniuse.com/mdn-javascript_builtins_function_name_configurable_true
|
||||
keepNames: false,
|
||||
target: 'es5',
|
||||
outfile: `build/lib/worker-main.polyfilled.min.js`
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue