mirror of
https://github.com/mue/mue.git
synced 2026-07-18 14:34:12 +02:00
feat: map for background location
Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
@@ -36,3 +36,13 @@ export function gradientStyleBuilder({ type, angle, gradient }) {
|
||||
style: `background:${gradient[0]?.colour};${grad}`
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// source: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#ECMAScript_.28JavaScript.2FActionScript.2C_etc..29
|
||||
export function lon2tile(lon, zoom) {
|
||||
return (Math.floor((lon + 180) / 360 * Math.pow(2, zoom)));
|
||||
}
|
||||
|
||||
export function lat2tile(lat, zoom) {
|
||||
return (Math.floor((1 - Math.log(Math.tan(lat * Math.PI / 180) + 1 / Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, zoom)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user