maplibre-gl 2.2.0-pre.3 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/README.md +73 -14
  2. package/build/generate-debug-index-file.ts +19 -0
  3. package/build/generate-style-code.ts +6 -1
  4. package/build/generate-style-spec.ts +151 -35
  5. package/build/generate-typings.ts +1 -1
  6. package/build/rollup_plugins.ts +4 -1
  7. package/dist/maplibre-gl-csp-worker.js +1 -1
  8. package/dist/maplibre-gl-csp-worker.js.map +1 -1
  9. package/dist/maplibre-gl-csp.js +1 -1
  10. package/dist/maplibre-gl-csp.js.map +1 -1
  11. package/dist/maplibre-gl-dev.js +364 -3124
  12. package/dist/maplibre-gl.css +1 -1
  13. package/dist/maplibre-gl.d.ts +439 -151
  14. package/dist/maplibre-gl.js +4 -4
  15. package/dist/maplibre-gl.js.map +1 -1
  16. package/package.json +68 -65
  17. package/src/css/maplibre-gl.css +39 -32
  18. package/src/data/bucket/fill_bucket.test.ts +1 -0
  19. package/src/data/bucket/symbol_bucket.test.ts +2 -0
  20. package/src/data/evaluation_feature.ts +1 -1
  21. package/src/data/program_configuration.ts +2 -2
  22. package/src/geo/transform.ts +4 -4
  23. package/src/gl/vertex_buffer.ts +4 -4
  24. package/src/index.ts +1 -1
  25. package/src/render/image_atlas.ts +1 -0
  26. package/src/render/image_manager.ts +1 -0
  27. package/src/render/program/debug_program.ts +1 -1
  28. package/src/render/render_to_texture.ts +3 -0
  29. package/src/render/terrain.ts +21 -21
  30. package/src/shaders/README.md +2 -2
  31. package/src/source/geojson_worker_source.test.ts +2 -2
  32. package/src/source/geojson_wrapper.test.ts +1 -1
  33. package/src/source/image_source.test.ts +8 -8
  34. package/src/source/image_source.ts +1 -1
  35. package/src/source/raster_tile_source.test.ts +1 -1
  36. package/src/source/source_cache.test.ts +12 -12
  37. package/src/source/source_cache.ts +1 -1
  38. package/src/source/terrain_source_cache.ts +3 -3
  39. package/src/source/vector_tile_source.test.ts +1 -1
  40. package/src/source/vector_tile_worker_source.test.ts +1 -1
  41. package/src/source/video_source.test.ts +2 -2
  42. package/src/source/worker.ts +2 -4
  43. package/src/style/light.test.ts +1 -1
  44. package/src/style/style.test.ts +3 -3
  45. package/src/style/style.ts +2 -2
  46. package/src/style/style_layer/background_style_layer_properties.g.ts +1 -0
  47. package/src/style/style_layer/circle_style_layer_properties.g.ts +1 -0
  48. package/src/style/style_layer/fill_extrusion_style_layer_properties.g.ts +1 -0
  49. package/src/style/style_layer/fill_style_layer_properties.g.ts +1 -0
  50. package/src/style/style_layer/heatmap_style_layer_properties.g.ts +1 -0
  51. package/src/style/style_layer/hillshade_style_layer_properties.g.ts +1 -0
  52. package/src/style/style_layer/line_style_layer_properties.g.ts +1 -0
  53. package/src/style/style_layer/raster_style_layer_properties.g.ts +1 -0
  54. package/src/style/style_layer/symbol_style_layer.ts +16 -1
  55. package/src/style/style_layer/symbol_style_layer_properties.g.ts +4 -3
  56. package/src/style-spec/CHANGELOG.md +5 -0
  57. package/src/style-spec/composite.test.ts +2 -0
  58. package/src/style-spec/diff.test.ts +3 -3
  59. package/src/style-spec/empty.ts +3 -2
  60. package/src/style-spec/expression/definitions/coercion.ts +13 -2
  61. package/src/style-spec/expression/definitions/interpolate.ts +1 -0
  62. package/src/style-spec/expression/expression.test.ts +1 -1
  63. package/src/style-spec/expression/expression.ts +3 -0
  64. package/src/style-spec/expression/index.ts +8 -2
  65. package/src/style-spec/expression/parsing_context.ts +2 -0
  66. package/src/style-spec/expression/types.ts +6 -1
  67. package/src/style-spec/expression/values.ts +9 -4
  68. package/src/style-spec/feature_filter/convert.ts +65 -65
  69. package/src/style-spec/feature_filter/feature_filter.test.ts +45 -4
  70. package/src/style-spec/feature_filter/index.ts +2 -1
  71. package/src/style-spec/function/index.test.ts +117 -1
  72. package/src/style-spec/function/index.ts +24 -12
  73. package/src/style-spec/migrate/expressions.ts +1 -1
  74. package/src/style-spec/migrate/v8.test.ts +2 -0
  75. package/src/style-spec/migrate/v9.test.ts +6 -4
  76. package/src/style-spec/migrate.test.ts +3 -1
  77. package/src/style-spec/package.json +1 -1
  78. package/src/style-spec/reference/latest.ts +2 -2
  79. package/src/style-spec/reference/v8.json +9 -6
  80. package/src/style-spec/style-spec.test.ts +2 -1
  81. package/src/style-spec/style-spec.ts +18 -9
  82. package/src/style-spec/types.g.ts +152 -36
  83. package/src/style-spec/util/interpolate.test.ts +5 -0
  84. package/src/style-spec/util/interpolate.ts +12 -0
  85. package/src/style-spec/util/padding.test.ts +27 -0
  86. package/src/style-spec/util/padding.ts +64 -0
  87. package/src/style-spec/validate/validate.ts +3 -1
  88. package/src/style-spec/validate/validate_padding.test.ts +82 -0
  89. package/src/style-spec/validate/validate_padding.ts +36 -0
  90. package/src/style-spec/validate_style.ts +1 -1
  91. package/src/symbol/check_max_angle.test.ts +5 -5
  92. package/src/symbol/collision_feature.test.ts +22 -5
  93. package/src/symbol/collision_feature.ts +7 -5
  94. package/src/symbol/collision_index.ts +1 -1
  95. package/src/symbol/get_anchors.test.ts +4 -4
  96. package/src/symbol/projection.ts +1 -1
  97. package/src/symbol/quads.test.ts +1 -1
  98. package/src/symbol/shaping.ts +10 -10
  99. package/src/symbol/symbol_layout.ts +5 -4
  100. package/src/symbol/symbol_style_layer.test.ts +1 -1
  101. package/src/ui/camera.test.ts +11 -11
  102. package/src/ui/control/geolocate_control.ts +1 -1
  103. package/src/ui/control/terrain_control.ts +4 -4
  104. package/src/ui/handler/cooperative_gestures.test.ts +167 -0
  105. package/src/ui/handler/drag_pan.test.ts +2 -1
  106. package/src/ui/handler/scroll_zoom.ts +7 -0
  107. package/src/ui/handler/touch_pan.ts +22 -2
  108. package/src/ui/handler/touch_zoom_rotate.ts +18 -1
  109. package/src/ui/handler_manager.ts +2 -2
  110. package/src/ui/map.test.ts +16 -16
  111. package/src/ui/map.ts +76 -8
  112. package/src/ui/map_events.test.ts +33 -32
  113. package/src/ui/popup.test.ts +2 -2
  114. package/src/util/ajax.test.ts +5 -5
  115. package/src/util/ajax.ts +1 -1
  116. package/src/util/classify_rings.test.ts +27 -27
  117. package/src/util/primitives.ts +4 -4
  118. package/src/util/resolve_tokens.test.ts +1 -1
  119. package/src/util/tile_request_cache.test.ts +5 -5
  120. package/src/util/util.test.ts +5 -5
  121. package/src/util/util.ts +2 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "maplibre-gl",
3
3
  "description": "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library",
4
- "version": "2.2.0-pre.3",
4
+ "version": "2.2.1",
5
5
  "main": "dist/maplibre-gl.js",
6
6
  "style": "dist/maplibre-gl.css",
7
7
  "license": "BSD-3-Clause",
@@ -12,125 +12,126 @@
12
12
  "types": "dist/maplibre-gl.d.ts",
13
13
  "type": "module",
14
14
  "dependencies": {
15
- "@mapbox/geojson-rewind": "^0.5.1",
15
+ "@mapbox/geojson-rewind": "^0.5.2",
16
16
  "@mapbox/jsonlint-lines-primitives": "^2.0.2",
17
17
  "@mapbox/mapbox-gl-supported": "^2.0.1",
18
18
  "@mapbox/point-geometry": "^0.1.0",
19
- "@mapbox/tiny-sdf": "^2.0.4",
19
+ "@mapbox/tiny-sdf": "^2.0.5",
20
20
  "@mapbox/unitbezier": "^0.0.1",
21
21
  "@mapbox/vector-tile": "^1.3.1",
22
22
  "@mapbox/whoots-js": "^3.1.0",
23
- "@types/geojson": "^7946.0.8",
23
+ "@types/geojson": "^7946.0.10",
24
24
  "@types/mapbox__point-geometry": "^0.1.2",
25
25
  "@types/mapbox__vector-tile": "^1.3.0",
26
26
  "@types/pbf": "^3.0.2",
27
27
  "csscolorparser": "~1.0.3",
28
- "earcut": "^2.2.3",
28
+ "earcut": "^2.2.4",
29
29
  "geojson-vt": "^3.2.1",
30
30
  "gl-matrix": "^3.4.3",
31
31
  "murmurhash-js": "^1.0.0",
32
32
  "pbf": "^3.2.1",
33
33
  "potpack": "^1.0.2",
34
34
  "quickselect": "^2.0.0",
35
- "supercluster": "^7.1.4",
35
+ "supercluster": "^7.1.5",
36
36
  "tinyqueue": "^2.0.3",
37
37
  "vt-pbf": "^3.1.3"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@mapbox/gazetteer": "^5.1.0",
41
41
  "@mapbox/mapbox-gl-rtl-text": "^0.2.3",
42
- "@mapbox/mvt-fixtures": "^3.6.0",
43
- "@rollup/plugin-commonjs": "^22.0.0",
42
+ "@mapbox/mvt-fixtures": "^3.9.0",
43
+ "@rollup/plugin-commonjs": "^22.0.2",
44
44
  "@rollup/plugin-json": "^4.1.0",
45
- "@rollup/plugin-node-resolve": "^13.1.3",
45
+ "@rollup/plugin-node-resolve": "^13.3.0",
46
46
  "@rollup/plugin-replace": "^4.0.0",
47
47
  "@rollup/plugin-strip": "^2.1.0",
48
- "@rollup/plugin-typescript": "^8.3.0",
49
- "@swc/cli": "^0.1.55",
50
- "@swc/core": "^1.2.135",
51
- "@swc/jest": "^0.2.17",
48
+ "@rollup/plugin-typescript": "^8.3.4",
52
49
  "@types/benchmark": "^2.1.1",
53
50
  "@types/browserify": "^12.0.37",
54
51
  "@types/cssnano": "^5.0.0",
55
- "@types/d3": "^7.1.0",
52
+ "@types/d3": "^7.4.0",
56
53
  "@types/diff": "^5.0.2",
57
54
  "@types/earcut": "^2.1.1",
58
- "@types/eslint": "^8.4.1",
59
- "@types/gl": "^4.1.0",
55
+ "@types/eslint": "^8.4.5",
56
+ "@types/gl": "^4.1.1",
60
57
  "@types/glob": "^7.2.0",
61
- "@types/jest": "^27.4.0",
62
- "@types/jsdom": "^16.2.14",
58
+ "@types/jest": "^28.1.6",
59
+ "@types/jsdom": "^20.0.0",
63
60
  "@types/minimist": "^1.2.2",
64
61
  "@types/murmurhash-js": "^1.0.3",
65
62
  "@types/nise": "^1.4.0",
66
- "@types/offscreencanvas": "^2019.6.4",
63
+ "@types/offscreencanvas": "^2019.7.0",
67
64
  "@types/pixelmatch": "^5.2.4",
68
65
  "@types/pngjs": "^6.0.1",
69
- "@types/react": "^18.0.8",
70
- "@types/react-dom": "^18.0.5",
66
+ "@types/react": "^18.0.15",
67
+ "@types/react-dom": "^18.0.6",
71
68
  "@types/request": "^2.48.8",
72
69
  "@types/rollup-plugin-json": "^3.0.3",
73
70
  "@types/shuffle-seed": "^1.1.0",
74
71
  "@types/supercluster": "^7.1.0",
75
72
  "@types/window-or-global": "^1.0.4",
76
- "@typescript-eslint/eslint-plugin": "^5.14.0",
77
- "@typescript-eslint/parser": "^5.14.0",
78
- "address": "^1.1.2",
73
+ "@typescript-eslint/eslint-plugin": "^5.32.0",
74
+ "@typescript-eslint/parser": "^5.32.0",
75
+ "acorn-import-assertions": "^1.8.0",
76
+ "address": "^1.2.0",
79
77
  "benchmark": "^2.1.4",
80
78
  "browserify": "^17.0.0",
81
- "canvas": "^2.9.0",
82
- "cssnano": "^5.0.16",
83
- "d3": "^7.3.0",
79
+ "canvas": "^2.9.3",
80
+ "cssnano": "^5.1.12",
81
+ "d3": "^7.6.1",
84
82
  "d3-queue": "^3.0.7",
85
- "diff": "^5.0.0",
86
- "documentation": "13.0.2",
87
- "dts-bundle-generator": "^6.4.0",
88
- "eslint": "^8.7.0",
83
+ "diff": "^5.1.0",
84
+ "documentation": "14.0.0-alpha.1",
85
+ "dts-bundle-generator": "^6.12.0",
86
+ "eslint": "^8.21.0",
89
87
  "eslint-config-mourner": "^3.0.0",
90
- "eslint-plugin-html": "^6.2.0",
91
- "eslint-plugin-import": "^2.25.4",
92
- "eslint-plugin-jest": "^26.0.0",
93
- "eslint-plugin-jsdoc": "^39.2.9",
94
- "eslint-plugin-react": "^7.28.0",
95
- "gl": "^5.0.0",
88
+ "eslint-plugin-html": "^7.1.0",
89
+ "eslint-plugin-import": "^2.26.0",
90
+ "eslint-plugin-jest": "^26.7.0",
91
+ "eslint-plugin-jsdoc": "^39.3.4",
92
+ "eslint-plugin-react": "^7.30.1",
93
+ "gl": "^5.0.3",
96
94
  "glob": "^8.0.3",
97
- "is-builtin-module": "^3.1.0",
98
- "jest": "^27.5.1",
99
- "jest-canvas-mock": "^2.3.1",
100
- "jest-playwright-preset": "^1.7.0",
101
- "jsdom": "^19.0.0",
95
+ "is-builtin-module": "^3.2.0",
96
+ "jest": "^28.1.3",
97
+ "jest-canvas-mock": "^2.4.0",
98
+ "jest-environment-jsdom": "^28.1.3",
99
+ "jest-playwright-preset": "^2.0.0",
100
+ "jsdom": "^20.0.0",
102
101
  "json-stringify-pretty-compact": "^4.0.0",
103
102
  "mapbox-gl-styles": "^2.0.2",
104
- "minimist": "^1.2.5",
103
+ "minimist": "^1.2.6",
105
104
  "mock-geolocation": "^1.0.11",
106
105
  "nise": "^5.1.1",
107
106
  "node-plantuml": "^0.9.0",
108
107
  "npm-font-open-sans": "^1.1.0",
109
108
  "npm-run-all": "^4.1.5",
110
- "pdf-merger-js": "^3.3.2",
111
- "pixelmatch": "^5.2.1",
112
- "playwright": "^1.18.1",
109
+ "pdf-merger-js": "^3.4.0",
110
+ "pixelmatch": "^5.3.0",
111
+ "playwright": "^1.24.2",
113
112
  "pngjs": "^6.0.0",
114
- "postcss": "^8.4.5",
115
- "postcss-cli": "^9.1.0",
113
+ "postcss": "^8.4.14",
114
+ "postcss-cli": "^10.0.0",
116
115
  "postcss-inline-svg": "^5.0.0",
117
116
  "pretty-bytes": "^6.0.0",
118
- "react": "^18.0.0",
119
- "react-dom": "^18.0.0",
117
+ "react": "^18.2.0",
118
+ "react-dom": "^18.2.0",
120
119
  "request": "^2.88.0",
121
- "rollup": "^2.66.1",
120
+ "rollup": "^2.77.2",
121
+ "rollup-plugin-import-assert": "^2.1.0",
122
122
  "rollup-plugin-sourcemaps": "^0.6.3",
123
123
  "rollup-plugin-terser": "^7.0.2",
124
- "rollup-plugin-unassert": "^0.4.0",
125
124
  "rw": "^1.3.3",
126
- "semver": "^7.3.5",
125
+ "semver": "^7.3.7",
127
126
  "shuffle-seed": "^1.1.6",
128
127
  "source-map-explorer": "^2.5.2",
129
128
  "st": "^3.0.0",
130
- "stylelint": "^14.3.0",
131
- "stylelint-config-standard": "^25.0.0",
132
- "ts-node": "^10.5.0",
133
- "typescript": "^4.6.2"
129
+ "stylelint": "^14.9.1",
130
+ "stylelint-config-standard": "^26.0.0",
131
+ "ts-jest": "^28.0.7",
132
+ "ts-node": "^10.9.1",
133
+ "typescript": "^4.7.4",
134
+ "unassert-rollup-plugin": "^2.0.0"
134
135
  },
135
136
  "scripts": {
136
137
  "generate-shaders": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-shaders.ts",
@@ -139,6 +140,7 @@
139
140
  "generate-style-spec": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-style-spec.ts",
140
141
  "generate-typings": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-typings.ts",
141
142
  "generate-query-test-fixtures": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-query-test-fixtures.ts",
143
+ "generate-debug-index-file": "node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-debug-index-file.ts",
142
144
  "build-dev": "rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev",
143
145
  "watch-dev": "rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev --watch",
144
146
  "build-prod": "rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:production",
@@ -154,22 +156,23 @@
154
156
  "start": "run-p watch-css start-server",
155
157
  "start-debug": "run-p watch-css watch-dev start-server",
156
158
  "start-bench": "run-p watch-css watch-benchmarks start-server-at-test",
157
- "lint": "eslint --cache --ext \".ts,.tsx,.js,.html\" --ignore-path .gitignore src test build debug/*.html jest.config.js",
159
+ "lint": "eslint --cache --ext \".ts,.tsx,.js,.html\" --ignore-path .gitignore src test build",
158
160
  "lint-docs": "documentation lint src/index.ts",
159
161
  "lint-css": "stylelint \"src/css/maplibre-gl.css\"",
160
162
  "test": "run-s lint lint-css lint-docs test-unit",
161
- "test-build": "jest --roots ./test/build",
163
+ "test-build": "jest -c ./jest.config.builds.ts --roots ./test/build",
162
164
  "test-symbol-shaping": "jest --roots ./test/integration/symbol-shaping",
163
165
  "test-style-spec": "jest --roots ./test/integration/style-spec",
164
- "test-browser": "jest -c ./jest.config.e2e.js --roots ./test/integration/browser",
165
- "test-render": "node --loader ts-node/esm --experimental-specifier-resolution=node --experimental-json-modules --max-old-space-size=2048 test/integration/render/render.test.ts",
166
- "test-query": "jest -c ./jest.config.e2e.js --roots ./test/integration/query",
166
+ "test-browser": "jest -c ./jest.config.e2e.ts --roots ./test/integration/browser",
167
+ "test-render": "node --loader ts-node/esm --experimental-specifier-resolution=node --max-old-space-size=2048 test/integration/render/render.test.ts",
168
+ "test-query": "jest -c ./jest.config.e2e.ts --roots ./test/integration/query",
167
169
  "test-expression": "jest --roots ./test/integration/expression",
168
- "test-unit": "jest --roots ./src",
169
- "codegen": "npm run generate-style-code && npm run generate-struct-arrays && npm run generate-style-spec && npm run generate-shaders",
170
+ "test-unit": "jest -c ./jest.config.ts --roots ./src",
171
+ "codegen": "npm run generate-style-code && npm run generate-struct-arrays && npm run generate-style-spec && npm run generate-shaders && npm run generate-debug-index-file",
170
172
  "benchmark": "node --loader ts-node/esm --experimental-specifier-resolution=node test/bench/run-benchmarks.ts",
171
173
  "gl-stats": "node --loader ts-node/esm --experimental-specifier-resolution=node test/bench/gl-stats.ts",
172
- "postinstall": "node ./postinstall.js"
174
+ "postinstall": "node ./postinstall.js",
175
+ "typecheck": "tsc --project tsconfig.typecheck.json"
173
176
  },
174
177
  "files": [
175
178
  "build/",
@@ -464,26 +464,6 @@
464
464
  100% { transform: rotate(360deg); }
465
465
  }
466
466
 
467
- @keyframes maplibregl-spin {
468
- 0% { transform: rotate(0deg); }
469
- 100% { transform: rotate(360deg); }
470
- }
471
-
472
- @keyframes maplibregl-spin {
473
- 0% { transform: rotate(0deg); }
474
- 100% { transform: rotate(360deg); }
475
- }
476
-
477
- @keyframes maplibregl-spin {
478
- 0% { transform: rotate(0deg); }
479
- 100% { transform: rotate(360deg); }
480
- }
481
-
482
- @keyframes maplibregl-spin {
483
- 0% { transform: rotate(0deg); }
484
- 100% { transform: rotate(360deg); }
485
- }
486
-
487
467
  a.maplibregl-ctrl-logo,
488
468
  a.mapboxgl-ctrl-logo {
489
469
  width: 88px;
@@ -542,6 +522,7 @@ a.mapboxgl-ctrl-logo.mapboxgl-compact {
542
522
  position: relative;
543
523
  background-color: #fff;
544
524
  border-radius: 12px;
525
+ box-sizing: content-box;
545
526
  }
546
527
 
547
528
  .maplibregl-ctrl-attrib.maplibregl-compact-show,
@@ -896,18 +877,6 @@ a.mapboxgl-ctrl-logo.mapboxgl-compact {
896
877
  100% { transform: scale(1); opacity: 0; }
897
878
  }
898
879
 
899
- @keyframes maplibregl-user-location-dot-pulse {
900
- 0% { transform: scale(1); opacity: 1; }
901
- 70% { transform: scale(3); opacity: 0; }
902
- 100% { transform: scale(1); opacity: 0; }
903
- }
904
-
905
- @keyframes maplibregl-user-location-dot-pulse {
906
- 0% { transform: scale(1); opacity: 1; }
907
- 70% { transform: scale(3); opacity: 0; }
908
- 100% { transform: scale(1); opacity: 0; }
909
- }
910
-
911
880
  .maplibregl-user-location-dot-stale,
912
881
  .mapboxgl-user-location-dot-stale {
913
882
  background-color: #aaa;
@@ -946,3 +915,41 @@ a.mapboxgl-ctrl-logo.mapboxgl-compact {
946
915
  border: 2px dotted #202020;
947
916
  opacity: 0.5;
948
917
  }
918
+
919
+ .maplibregl-cooperative-gesture-screen {
920
+ background: rgba(0 0 0 / 40%);
921
+ position: absolute;
922
+ top: 0;
923
+ left: 0;
924
+ right: 0;
925
+ bottom: 0;
926
+ display: flex;
927
+ justify-content: center;
928
+ align-items: center;
929
+ color: white;
930
+ padding: 1rem;
931
+ font-size: 1.4em;
932
+ line-height: 1.2;
933
+ opacity: 0;
934
+ pointer-events: none;
935
+ transition: opacity 1s ease 1s;
936
+ }
937
+
938
+ .maplibregl-cooperative-gesture-screen.maplibregl-show {
939
+ opacity: 1;
940
+ transition: opacity 0.05s;
941
+ }
942
+
943
+ .maplibregl-cooperative-gesture-screen .maplibregl-mobile-message {
944
+ display: none;
945
+ }
946
+
947
+ @media (hover: none), (max-width: 480px) {
948
+ .maplibregl-cooperative-gesture-screen .maplibregl-desktop-message {
949
+ display: none;
950
+ }
951
+
952
+ .maplibregl-cooperative-gesture-screen .maplibregl-mobile-message {
953
+ display: block;
954
+ }
955
+ }
@@ -55,6 +55,7 @@ test('FillBucket segmentation', () => {
55
55
  id: 'test',
56
56
  type: 'fill',
57
57
  layout: {},
58
+ source: 'source',
58
59
  paint: {
59
60
  'fill-color': ['to-color', ['get', 'foo'], '#000']
60
61
  }
@@ -1,3 +1,5 @@
1
+ // @ts-nocheck
2
+
1
3
  import fs from 'fs';
2
4
  import path from 'path';
3
5
  import Protobuf from 'pbf';
@@ -26,6 +26,6 @@ type EvaluationFeature = {
26
26
  export default function toEvaluationFeature(feature: VectorTileFeature, needGeometry: boolean): EvaluationFeature {
27
27
  return {type: feature.type,
28
28
  id: feature.id,
29
- properties:feature.properties,
29
+ properties: feature.properties,
30
30
  geometry: needGeometry ? loadGeometry(feature) : []};
31
31
  }
@@ -698,7 +698,7 @@ function paintAttributeNames(property, type) {
698
698
 
699
699
  function getLayoutException(property) {
700
700
  const propertyExceptions = {
701
- 'line-pattern':{
701
+ 'line-pattern': {
702
702
  'source': PatternLayoutArray,
703
703
  'composite': PatternLayoutArray
704
704
  },
@@ -706,7 +706,7 @@ function getLayoutException(property) {
706
706
  'source': PatternLayoutArray,
707
707
  'composite': PatternLayoutArray
708
708
  },
709
- 'fill-extrusion-pattern':{
709
+ 'fill-extrusion-pattern': {
710
710
  'source': PatternLayoutArray,
711
711
  'composite': PatternLayoutArray
712
712
  }
@@ -493,7 +493,7 @@ class Transform {
493
493
  * get the elevation from terrain for the current zoomlevel.
494
494
  * @param lnglat the location
495
495
  * @param terrain the terrain
496
- * @returns {Number} elevation in meters
496
+ * @returns {number} elevation in meters
497
497
  */
498
498
  getElevation(lnglat: LngLat, terrain: Terrain) {
499
499
  const merc = MercatorCoordinate.fromLngLat(lnglat);
@@ -651,8 +651,8 @@ class Transform {
651
651
  /**
652
652
  * Given a coordinate, return the screen point that corresponds to it
653
653
  * @param {Coordinate} coord
654
- * @params {number} elevation default = 0
655
- * @params {mat4} pixelMatrix, default = this.pixelMatrix
654
+ * @param {number} elevation default = 0
655
+ * @param {mat4} pixelMatrix, default = this.pixelMatrix
656
656
  * @returns {Point} screen point
657
657
  * @private
658
658
  */
@@ -919,7 +919,7 @@ class Transform {
919
919
  dx = x - Math.round(x) + angleCos * xShift + angleSin * yShift,
920
920
  dy = y - Math.round(y) + angleCos * yShift + angleSin * xShift;
921
921
  const alignedM = new Float64Array(m) as any as mat4;
922
- mat4.translate(alignedM, alignedM, [ dx > 0.5 ? dx - 1 : dx, dy > 0.5 ? dy - 1 : dy, 0 ]);
922
+ mat4.translate(alignedM, alignedM, [dx > 0.5 ? dx - 1 : dx, dy > 0.5 ? dy - 1 : dy, 0]);
923
923
  this.alignedProjMatrix = alignedM;
924
924
 
925
925
  // inverse matrix for conversion from screen coordinaes to location
@@ -14,11 +14,11 @@ import type Context from '../gl/context';
14
14
  * @readonly
15
15
  */
16
16
  const AttributeType = {
17
- Int8: 'BYTE',
18
- Uint8: 'UNSIGNED_BYTE',
19
- Int16: 'SHORT',
17
+ Int8: 'BYTE',
18
+ Uint8: 'UNSIGNED_BYTE',
19
+ Int16: 'SHORT',
20
20
  Uint16: 'UNSIGNED_SHORT',
21
- Int32: 'INT',
21
+ Int32: 'INT',
22
22
  Uint32: 'UNSIGNED_INT',
23
23
  Float32: 'FLOAT'
24
24
  };
package/src/index.ts CHANGED
@@ -237,7 +237,7 @@ Debug.extend(exported, {isSafari, getPerformanceMetrics: PerformanceUtils.getPer
237
237
  * @param {boolean} lazy If set to `true`, mapboxgl will defer loading the plugin until rtl text is encountered,
238
238
  * rtl text will then be rendered only after the plugin finishes loading.
239
239
  * @example
240
- * maplibregl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js');
240
+ * maplibregl.setRTLTextPlugin('https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.js');
241
241
  * @see [Add support for right-to-left scripts](https://maplibre.org/maplibre-gl-js-docs/example/mapbox-gl-rtl-text/)
242
242
  */
243
243
 
@@ -1,3 +1,4 @@
1
+ /* eslint-disable key-spacing */
1
2
  import {RGBAImage} from '../util/image';
2
3
  import {register} from '../util/web_worker_transfer';
3
4
  import potpack from 'potpack';
@@ -1,3 +1,4 @@
1
+ /* eslint-disable key-spacing */
1
2
  import potpack from 'potpack';
2
3
 
3
4
  import {Event, ErrorEvent, Evented} from '../util/evented';
@@ -16,7 +16,7 @@ const debugUniforms = (context: Context, locations: UniformLocations): DebugUnif
16
16
  'u_color': new UniformColor(context, locations.u_color),
17
17
  'u_matrix': new UniformMatrix4f(context, locations.u_matrix),
18
18
  'u_overlay': new Uniform1i(context, locations.u_overlay),
19
- 'u_overlay_scale': new Uniform1f(context, locations.u_overlay_scale)
19
+ 'u_overlay_scale': new Uniform1f(context, locations.u_overlay_scale)
20
20
  });
21
21
 
22
22
  const debugUniformValues = (matrix: mat4, color: Color, scaleRatio: number = 1): UniformValues<DebugUniformsType> => ({
@@ -5,6 +5,9 @@ import {OverscaledTileID} from '../source/tile_id';
5
5
  import {prepareTerrain, drawTerrain} from './draw_terrain';
6
6
  import type StyleLayer from '../style/style_layer';
7
7
 
8
+ /**
9
+ * RenderToTexture
10
+ */
8
11
  export default class RenderToTexture {
9
12
  painter: Painter;
10
13
  // this object holds a lookup table which layers should rendered to texture
@@ -20,6 +20,25 @@ import EXTENT from '../data/extent';
20
20
  import {number as mix} from '../style-spec/util/interpolate';
21
21
  import type {TerrainSpecification} from '../style-spec/types.g';
22
22
 
23
+ export type TerrainData = {
24
+ 'u_depth': number;
25
+ 'u_terrain': number;
26
+ 'u_terrain_dim': number;
27
+ 'u_terrain_matrix': mat4;
28
+ 'u_terrain_unpack': number[];
29
+ 'u_terrain_offset': number;
30
+ 'u_terrain_exaggeration': number;
31
+ texture: WebGLTexture;
32
+ depthTexture: WebGLTexture;
33
+ tile: Tile;
34
+ }
35
+
36
+ export type TerrainMesh = {
37
+ indexBuffer: IndexBuffer;
38
+ vertexBuffer: VertexBuffer;
39
+ segments: SegmentVector;
40
+ }
41
+
23
42
  /**
24
43
  * This is the main class which handles most of the 3D Terrain logic. It has the follwing topics:
25
44
  * 1) loads raster-dem tiles via the internal sourceCache this.sourceCache
@@ -48,25 +67,6 @@ import type {TerrainSpecification} from '../style-spec/types.g';
48
67
  *
49
68
  */
50
69
 
51
- export type TerrainData = {
52
- 'u_depth': number;
53
- 'u_terrain': number;
54
- 'u_terrain_dim': number;
55
- 'u_terrain_matrix': mat4;
56
- 'u_terrain_unpack': number[];
57
- 'u_terrain_offset': number;
58
- 'u_terrain_exaggeration': number;
59
- texture: WebGLTexture;
60
- depthTexture: WebGLTexture;
61
- tile: Tile;
62
- }
63
-
64
- export type TerrainMesh = {
65
- indexBuffer: IndexBuffer;
66
- vertexBuffer: VertexBuffer;
67
- segments: SegmentVector;
68
- }
69
-
70
70
  export default class Terrain {
71
71
  // The style this terrain crresponds to
72
72
  style: Style;
@@ -143,8 +143,8 @@ export default class Terrain {
143
143
  const terrain = this.getTerrainData(tileID);
144
144
  if (terrain.tile && terrain.tile.dem) {
145
145
  const pos = vec2.transformMat4([] as any, [x / extent * EXTENT, y / extent * EXTENT], terrain.u_terrain_matrix);
146
- const coord = [ pos[0] * terrain.tile.dem.dim, pos[1] * terrain.tile.dem.dim ];
147
- const c = [ Math.floor(coord[0]), Math.floor(coord[1]) ];
146
+ const coord = [pos[0] * terrain.tile.dem.dim, pos[1] * terrain.tile.dem.dim];
147
+ const c = [Math.floor(coord[0]), Math.floor(coord[1])];
148
148
  const tl = terrain.tile.dem.get(c[0], c[1]);
149
149
  const tr = terrain.tile.dem.get(c[0], c[1] + 1);
150
150
  const bl = terrain.tile.dem.get(c[0] + 1, c[1]);
@@ -1,6 +1,6 @@
1
- # Mapbox GL Shaders
1
+ # MapLibre GL Shaders
2
2
 
3
- This repository contains GL shaders which are shared by [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js) and [Mapbox GL Native](https://github.com/mapbox/mapbox-gl-native).
3
+ This repository contains GL shaders which are shared by [MapLibre GL JS](https://github.com/maplibre/maplibre-gl-js) and [MapLibre GL Native](https://github.com/maplibre/maplibre-gl-native).
4
4
 
5
5
  ## Pragmas
6
6
 
@@ -130,7 +130,7 @@ describe('resourceTiming', () => {
130
130
  secureConnectionStart: 0
131
131
  } as any as PerformanceEntry;
132
132
 
133
- window.performance.getEntriesByName = jest.fn().mockReturnValue([ exampleResourceTiming ]);
133
+ window.performance.getEntriesByName = jest.fn().mockReturnValue([exampleResourceTiming]);
134
134
 
135
135
  const layerIndex = new StyleLayerIndex(layers);
136
136
  const source = new GeoJSONWorkerSource(actor, layerIndex, [], (params, callback) => {
@@ -140,7 +140,7 @@ describe('resourceTiming', () => {
140
140
 
141
141
  source.loadData({source: 'testSource', request: {url: 'http://localhost/nonexistent', collectResourceTiming: true}} as LoadGeoJSONParameters, (err, result) => {
142
142
  expect(err).toBeNull();
143
- expect(result.resourceTiming.testSource).toEqual([ exampleResourceTiming ]);
143
+ expect(result.resourceTiming.testSource).toEqual([exampleResourceTiming]);
144
144
  done();
145
145
  });
146
146
  });
@@ -14,7 +14,7 @@ describe('geojsonwrapper', () => {
14
14
  expect(feature).toBeTruthy();
15
15
  expect(feature.loadGeometry()).toEqual([[{x: 0, y: 0}, {x: 10, y: 10}]]);
16
16
  expect(feature.type).toBe(2);
17
- expect(feature.properties).toEqual({hello:'world'});
17
+ expect(feature.properties).toEqual({hello: 'world'});
18
18
 
19
19
  });
20
20
 
@@ -47,7 +47,7 @@ describe('ImageSource', () => {
47
47
  };
48
48
 
49
49
  test('constructor', () => {
50
- const source = createSource({url : '/image.png'});
50
+ const source = createSource({url: '/image.png'});
51
51
 
52
52
  expect(source.minzoom).toBe(0);
53
53
  expect(source.maxzoom).toBe(22);
@@ -55,7 +55,7 @@ describe('ImageSource', () => {
55
55
  });
56
56
 
57
57
  test('fires dataloading event', () => {
58
- const source = createSource({url : '/image.png'});
58
+ const source = createSource({url: '/image.png'});
59
59
  source.on('dataloading', (e) => {
60
60
  expect(e.dataType).toBe('source');
61
61
  });
@@ -65,7 +65,7 @@ describe('ImageSource', () => {
65
65
  });
66
66
 
67
67
  test('transforms url request', () => {
68
- const source = createSource({url : '/image.png'});
68
+ const source = createSource({url: '/image.png'});
69
69
  const map = new StubMap() as any;
70
70
  const spy = jest.spyOn(map._requestManager, 'transformRequest');
71
71
  source.onAdd(map);
@@ -76,7 +76,7 @@ describe('ImageSource', () => {
76
76
  });
77
77
 
78
78
  test('updates url from updateImage', () => {
79
- const source = createSource({url : '/image.png'});
79
+ const source = createSource({url: '/image.png'});
80
80
  const map = new StubMap() as any;
81
81
  const spy = jest.spyOn(map._requestManager, 'transformRequest');
82
82
  source.onAdd(map);
@@ -92,7 +92,7 @@ describe('ImageSource', () => {
92
92
  });
93
93
 
94
94
  test('sets coordinates', () => {
95
- const source = createSource({url : '/image.png'});
95
+ const source = createSource({url: '/image.png'});
96
96
  const map = new StubMap() as any;
97
97
  source.onAdd(map);
98
98
  respond();
@@ -104,7 +104,7 @@ describe('ImageSource', () => {
104
104
  });
105
105
 
106
106
  test('sets coordinates via updateImage', () => {
107
- const source = createSource({url : '/image.png'});
107
+ const source = createSource({url: '/image.png'});
108
108
  const map = new StubMap() as any;
109
109
  source.onAdd(map);
110
110
  respond();
@@ -120,7 +120,7 @@ describe('ImageSource', () => {
120
120
  });
121
121
 
122
122
  test('fires data event when content is loaded', done => {
123
- const source = createSource({url : '/image.png'});
123
+ const source = createSource({url: '/image.png'});
124
124
  source.on('data', (e) => {
125
125
  if (e.dataType === 'source' && e.sourceDataType === 'content') {
126
126
  expect(typeof source.tileID == 'object').toBeTruthy();
@@ -132,7 +132,7 @@ describe('ImageSource', () => {
132
132
  });
133
133
 
134
134
  test('fires data event when metadata is loaded', done => {
135
- const source = createSource({url : '/image.png'});
135
+ const source = createSource({url: '/image.png'});
136
136
  source.on('data', (e) => {
137
137
  if (e.dataType === 'source' && e.sourceDataType === 'metadata') {
138
138
  done();
@@ -209,7 +209,7 @@ class ImageSource extends Evented implements Source {
209
209
  delete this.boundsBuffer;
210
210
  }
211
211
 
212
- this.fire(new Event('data', {dataType:'source', sourceDataType: 'content'}));
212
+ this.fire(new Event('data', {dataType: 'source', sourceDataType: 'content'}));
213
213
  return this;
214
214
  }
215
215