Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/remaining-issues-…
Browse files Browse the repository at this point in the history
…camera-inside-terrain
  • Loading branch information
chrneumann committed Oct 30, 2024
2 parents 9940ea5 + 9d9a600 commit 0f0d4de
Show file tree
Hide file tree
Showing 224 changed files with 7,369 additions and 1,903 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"lowp",
"Luxemburg",
"mapa",
"mapboxgl",
"maplibregl",
"mapme",
"mappedin",
Expand Down
107 changes: 0 additions & 107 deletions .eslintrc.json

This file was deleted.

6 changes: 2 additions & 4 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ jobs:
rm -rf docs/API/_media
docker run --rm -v ${PWD}:/docs squidfunk/mkdocs-material build --strict
- name: Check spelling
uses: streetsidesoftware/cspell-action@v6
with:
files: "**/*.{html,md}"
incremental_files_only: false
# This need to run after the docs are built
run: npm run spellcheck

unit-tests:
name: Unit tests and Coverage
Expand Down
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,50 @@
- _...Add new stuff here..._

### 🐞 Bug fixes

- Fix line-placed map-pitch-aligned texts being too large when viewed from some latitudes on a globe ([#4786](https://github.com/maplibre/maplibre-gl-js/issues/4786))
- Fix crashes when camera is inside terrain. Add padding between camera and surface to prevent cases like this. ([#1542](https://github.com/maplibre/maplibre-gl-js/issues/1542))
- _...Add new stuff here..._

## 5.0.0-pre.4

### ✨ Features and improvements

- ⚠️ Changed `geometry-type` to identify "Multi-" features ([#4877](https://github.com/maplibre/maplibre-gl-js/pull/4877))
- Add support for pitch > 90 degrees ([#4717](https://github.com/maplibre/maplibre-gl-js/issues/4717))

### 🐞 Bug fixes

- ⚠️ Fix order of normalizeSpriteURL and transformRequest in loadSprite ([#3897](https://github.com/maplibre/maplibre-gl-js/issues/3897))
- ⚠️ Remove unminified prod build ([#4906](https://github.com/maplibre/maplibre-gl-js/pull/4906))
- Fix issue where raster tile source won't fetch updates following request error ([#4890](https://github.com/maplibre/maplibre-gl-js/pull/4890))
- Fix 3D models in custom layers not being properly occluded by the globe ([#4817](https://github.com/maplibre/maplibre-gl-js/issues/4817))
- Fix issue where raster tiles were not rendered correctly when using globe and terrain ([#4912](https://github.com/maplibre/maplibre-gl-js/pull/4912))

## v5.0.0-pre.3

### ✨ Features and improvements

- Add support for camera roll angle ([#4717](https://github.com/maplibre/maplibre-gl-js/issues/4717))

### 🐞 Bug fixes

- Fix text not being hidden behind the globe when overlap mode was set to `always` ([#4802](https://github.com/maplibre/maplibre-gl-js/issues/4802))
- Fix a single white frame being displayed when the map internally transitions from mercator to globe projection ([#4816](https://github.com/maplibre/maplibre-gl-js/issues/4816))
- Fix loading of RTL plugin version 0.3.0 ([#4860](https://github.com/maplibre/maplibre-gl-js/pull/4860))

## 5.0.0-pre.2

### ✨ Features and improvements

- Improve performance of `queryRenderedFeatures` by using JavaScript `Set`s to assess layer membership internally ([#4777](https://github.com/maplibre/maplibre-gl-js/pull/4777))

### 🐞 Bug fixes

- Fix a memory leak due to missing removal of event listener registration ([#4824](https://github.com/maplibre/maplibre-gl-js/pull/4824))
- Improve symbol collision performance for both mercator and globe projections ([#4778](https://github.com/maplibre/maplibre-gl-js/pull/4778))
- Fix bad line scaling near the poles under globe projection ([#4778](https://github.com/maplibre/maplibre-gl-js/pull/4778))
- Fix globe loading many tiles at an unnecessarily high zoom level when the camera is pitched ([#4778](https://github.com/maplibre/maplibre-gl-js/pull/4778))

## 5.0.0-pre.1

Expand Down
2 changes: 1 addition & 1 deletion build/generate-doc-images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function createImage(exampleName) {
const waitTime = (exampleName.includes('3d-model') || exampleName.includes('globe')) ? 5000 : 1500;
console.log(`waiting for ${waitTime} ms`);
await new Promise(resolve => setTimeout(resolve, waitTime));
} catch (err) {
} catch {
// map.loaded() does not evaluate to true within 3 seconds, it's probably an animated example.
// In this case we take the screenshot immediately.
console.log(`Timed out waiting for map load on ${exampleName}.`);
Expand Down
2 changes: 1 addition & 1 deletion build/generate-struct-arrays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ export class ${structArrayClass} extends ${structArrayLayoutClass} {`);
output.push(
` /**
* Return the ${structTypeClass} at the given location in the array.
* @param index The index of the element.
* @param index - The index of the element.
*/
get(index: number): ${structTypeClass} {
return new ${structTypeClass}(this, index);
Expand Down
5 changes: 2 additions & 3 deletions build/rollup_plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const nodeResolve = resolve({
preferBuiltins: false
});

export const plugins = (production: boolean, minified: boolean): Plugin[] => [
export const plugins = (production: boolean): Plugin[] => [
json(),
// https://github.com/zaach/jison/issues/351
replace({
Expand All @@ -31,9 +31,8 @@ export const plugins = (production: boolean, minified: boolean): Plugin[] => [
sourceMap: true,
functions: ['PerformanceUtils.*']
}),
minified && terser({
terser({
compress: {
// eslint-disable-next-line camelcase
pure_getters: true,
passes: 3
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added developer-guides/assets/center-point_nominal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions developer-guides/center-point.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# How Camera position is calculated

This guide describes how camera position is calculated from the center point, zoom, and camera rotation.
The `Transform` variables `center`, `elevation`, `zoom`, `pitch`, `bearing`, and `fov` control the location of the camera indirectly.

`elevation` sets the height of the "center point" above sea level. In the typical use case (`centerClampedToGround = true`), the library modifies `elevation` in an attempt to keep the center point always on the terrain (or 0 MSL if no terrain is enabled). When `centerClampedToGround = false`, the user provides the elevation of the center point.

`zoom` sets the distance from the center point to the camera (in conjunction with `fovInRadians`, which is currently hardcoded).

Together, `zoom`, `elevation`, and `pitch` set the altitude of the camera:

See `MercatorTransform::getCameraAltitude()`:
```typescript
getCameraAltitude(): number {
const altitude = Math.cos(this.pitchInRadians) * this._cameraToCenterDistance / this._helper._pixelPerMeter;
return altitude + this.elevation;
}
```

![image](assets/center-point_nominal.png)

To allow pitch > 90, the "center point" must be placed off of the ground. This will allow the camera to stay above the ground when it pitches above 90. This requires setting `centerClampedToGround = false`.

![image](assets/center-point_high-pitch.png)

The same math applies whether the center point is on terrain or not, and whether the camera is above or below the ground:

![image](assets/center-point_straight-up.png)
![image](assets/center-point_underground.png)


To help users position the camera, `Camera` exports the function `calculateCameraOptionsFromCameraLngLatAltRotation()`.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/examples/center-point.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0f0d4de

Please sign in to comment.