Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Android KitKat support #470

Merged
merged 1 commit into from Apr 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion core/code/utils_misc.js
Expand Up @@ -330,6 +330,14 @@ if (typeof String.prototype.startsWith !== 'function') {
};
}

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc#polyfill
// (required for KitKat support)
if (!Math.trunc) {
Math.trunc = function (v) {
return v < 0 ? Math.ceil(v) : Math.floor(v);
};
}

// escape a javascript string, so quotes and backslashes are escaped with a backslash
// (for strings passed as parameters to html onclick="..." for example)
window.escapeJavascriptString = function(str) {
Expand Down Expand Up @@ -483,7 +491,7 @@ window.makePermalink = function (latlng, options) {
options = options || {};

function round (l) { // ensures that lat,lng are with same precision as in stock intel permalinks
return Math.trunc(l*1e6)/1e6;
return Math.floor(l*1e6)/1e6;
modos189 marked this conversation as resolved.
Show resolved Hide resolved
}
var args = [];
if (!latlng || options.includeMapView) {
Expand Down