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