Skip to content

Commit

Permalink
Merge branch 'main' into feature/documentation-example-images-convert…
Browse files Browse the repository at this point in the history
…ed-to-webp
  • Loading branch information
YohanSciubukgian committed Jun 27, 2024
2 parents c78a771 + 6612f1b commit 5c4dc9a
Show file tree
Hide file tree
Showing 46 changed files with 1,059 additions and 149 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ jobs:
- run: npm run typecheck
if: '!cancelled()'
- run: npm run generate-docs
- run: docker run --rm -v ${PWD}:/docs squidfunk/mkdocs-material build
- name: Build docs using docker and mkdocs-material
run: |
rm docs/README.md
docker run --rm -v ${PWD}:/docs squidfunk/mkdocs-material build --strict
unit-tests:
name: Unit tests and Coverage
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/docs/API
/docs/examples
/docs/example
/site/
.cache/
*.es.js
*.js.map
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## main

### ✨ Features and improvements
- Add sky implementation according to spec ([#3645](https://github.com/maplibre/maplibre-gl-js/pull/3645))
- _...Add new stuff here..._

### 🐞 Bug fixes
Expand Down
21 changes: 15 additions & 6 deletions build/generate-doc-images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import puppeteer from 'puppeteer';
import packageJson from '../package.json' with { type: 'json' };

const exampleName = process.argv[2];
const useLocalhost = (process.argv.length > 3) && (process.argv[3] === 'serve');
const examplePath = path.resolve('test', 'examples');

const browser = await puppeteer.launch({headless: exampleName === 'all'});
const browser = await puppeteer.launch({headless: true});

const page = await browser.newPage();
// set viewport and double deviceScaleFactor to get a closer shot of the map
Expand All @@ -18,9 +19,13 @@ await page.setViewport({

async function createImage(exampleName) {
// get the example contents
const html = fs.readFileSync(path.resolve(examplePath, `${exampleName}.html`), 'utf-8');

await page.setContent(html.replaceAll('../../dist', `https://unpkg.com/maplibre-gl@${packageJson.version}/dist`));
if (useLocalhost) {
console.log('Using localhost to serve examples.');
await page.goto(`http://localhost:9966/test/examples/${exampleName}.html`);
} else {
const html = fs.readFileSync(path.resolve(examplePath, `${exampleName}.html`), 'utf-8');
await page.setContent(html.replaceAll('../../dist', `https://unpkg.com/maplibre-gl@${packageJson.version}/dist`));
}

// Wait for map to load, then wait two more seconds for images, etc. to load.
try {
Expand Down Expand Up @@ -61,8 +66,12 @@ if (exampleName === 'all') {
} else if (exampleName) {
await createImage(exampleName);
} else {
throw new Error(
'\n Usage: npm run generate-images <file-name|all>\nExample: npm run generate-images 3d-buildings'
throw new Error(`
Usage: npm run generate-images <file-name|all> [serve]
file-name: the name of the example file in test/examples without the .html extension.
all: generate images for all examples.
serve: use localhost to serve examples - use 'npm run start' with this option, otherwise it will use the latest published version in npm.
Example: npm run generate-images 3d-buildings serve`
);
}

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 @@ -233,7 +233,7 @@ function emitStructArrayLayout(locals) {

for (const member of members) {
output.push(
` * [${member.offset}]: ${member.type}[${member.components}]`);
` * [${member.offset}] - ${member.type}[${member.components}]`);
}

output.push(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/guides/large-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Once the data is loaded, to ensure a smooth user experience, it's essential to o

One simple approach is to visualise fewer points. If we are using a GeoJSON source (i.e. not vector tiles), we can use 'clustering' to group nearby points together. This approach reduces the number of features displayed on the map, improving rendering performance and maintaining map readability.

To do this, when we add the data, we can adjust the [cluster options](/maplibre-gl-js/docs/API/type-aliases/SetClusterOptions/). For example:
To do this, when we add the data, we can adjust the [cluster options](../API/type-aliases/SetClusterOptions.md). For example:

```javascript
map.addSource('earthquakes', {
Expand Down
5 changes: 5 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,8 @@ plugins:
- social:
cards_layout_options:
background_color: '#295DAA'
validation:
omitted_files: warn
absolute_links: warn
unrecognized_links: warn
anchors: warn
Loading

0 comments on commit 5c4dc9a

Please sign in to comment.