1 //= require maplibre/controls
2 //= require maplibre/dom_util
3 //= require maplibre/styles
5 maplibregl.Map.prototype._getUIString = function (key) {
6 const snakeCaseKey = key.replaceAll(/(?<=\w)[A-Z]/g, "_$&").toLowerCase();
7 return OSM.i18n.t(`javascripts.map.${snakeCaseKey}`);
10 OSM.MapLibre.Map = class extends maplibregl.Map {
11 constructor({ allowRotation, ...options } = {}) {
12 const rotationOptions = {};
13 if (allowRotation === false) {
14 Object.assign(rotationOptions, {
17 pitchWithRotate: false,
22 // Style validation only affects debug output.
23 // Style errors are usually reported to authors, who should validate the style in CI for better error messages.
28 if (allowRotation === false) {
29 map.touchZoomRotate.disableRotation();
30 map.keyboard.disableRotation();
36 OSM.MapLibre.SecondaryMap = class extends OSM.MapLibre.Map {
37 constructor(options = {}) {
38 const defaultHomeZoom = 11;
41 style: OSM.MapLibre.Styles.Mapnik(),
42 attributionControl: false,
45 center: OSM.home ? [OSM.home.lon, OSM.home.lat] : [0, 0],
46 zoom: OSM.home ? defaultHomeZoom : 0,