Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
titouanmathis committed Nov 18, 2019
2 parents bfb5537 + 943316b commit 4eacc9c
Show file tree
Hide file tree
Showing 20 changed files with 18,449 additions and 12,058 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
.DS_Store
node_modules

# NPM files
package-lock.json
# Yarn files
yarn.lock

# Log files
npm-debug.log*
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ The following components are available:
| [MapboxMarker](https://vue-mapbox-gl.meta.fr/components/MapboxMarker) | Display a simple or custom marker. ||
| [MapboxCluster](https://vue-mapbox-gl.meta.fr/components/MapboxCluster) | Display a GeoJSON as clusters. ||
| [MapboxGeocoder](https://vue-mapbox-gl.meta.fr/components/MapboxGeocoder) | Display a geocoder search input with the [@mapbox/mapbox-gl-geocoder](https://github.com/mapbox/mapbox-gl-geocoder) plugin. ||
| [MapboxImage](https://vue-mapbox-gl.meta.fr/components/MapboxImage) | Load an image to be used on the map. ||
| [MapboxImage](https://vue-mapbox-gl.meta.fr/components/MapboxImage) | Load an image to be used on the map. ||
| [MapboxImages](https://vue-mapbox-gl.meta.fr/components/MapboxImages) | Load multiple images to be used on the map. ||
| [MapboxLayer](https://vue-mapbox-gl.meta.fr/components/MapboxLayer) | Display a layer on the map. ||
| [MapboxNavigationControl](https://vue-mapbox-gl.meta.fr/components/MapboxNavigationControl) | Display the map's navigation controls ||
| [MapboxPopup](https://vue-mapbox-gl.meta.fr/components/MapboxPopup) | Display a popup on the map ||
Expand Down
219 changes: 176 additions & 43 deletions dist/VueMapboxGl.common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/VueMapboxGl.common.js.map

Large diffs are not rendered by default.

219 changes: 176 additions & 43 deletions dist/VueMapboxGl.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/VueMapboxGl.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/VueMapboxGl.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/VueMapboxGl.umd.min.js.map

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions docs/.vuepress/components/MapboxImagesDemo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<template>
<mapbox-map
style="height: 400px"
:access-token="MAPBOX_API_KEY"
map-style="mapbox://styles/mapbox/streets-v11"
:center="[0, 0]"
:zoom="1">
<mapbox-images :sources="iconSources">
<mapbox-layer
id="pois"
:options="layerOptions" />
</mapbox-images>
</mapbox-map>
</template>

<script>
export default {
data() {
return {
iconSources: [
{
src:
'https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Dog_silhouette.svg/429px-Dog_silhouette.svg.png',
id: 'dog',
},
{
src:
'https://upload.wikimedia.org/wikipedia/commons/thumb/6/60/Cat_silhouette.svg/400px-Cat_silhouette.svg.png',
id: 'cat',
},
],
layerOptions: {
type: 'symbol',
source: {
type: 'geojson',
data: {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {
icon: 'cat',
},
geometry: {
type: 'Point',
coordinates: [ -25, 0 ],
},
},
{
type: 'Feature',
properties: {
icon: 'dog',
},
geometry: {
type: 'Point',
coordinates: [ 25, 0 ],
},
},
],
},
},
layout: {
'icon-image': [ 'get', 'icon' ],
'icon-size': 0.25,
},
},
};
},
};
</script>
10 changes: 7 additions & 3 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ module.exports = {
configFile: true,
});

config
.plugin('env')
.use(webpack.EnvironmentPlugin, [ 'MAPBOX_API_KEY' ]);
config.plugin('env').use(webpack.EnvironmentPlugin, [ 'MAPBOX_API_KEY' ]);

config.resolve.alias.set(
'@studiometa/vue-mapbox-gl',
resolve(__dirname, '../../src')
);
},
themeConfig: {
nav: [
Expand All @@ -43,6 +46,7 @@ module.exports = {
{ text: 'MapboxCluster', link: '/components/MapboxCluster' },
{ text: 'MapboxGeocoder', link: '/components/MapboxGeocoder' },
{ text: 'MapboxImage', link: '/components/MapboxImage' },
{ text: 'MapboxImages', link: '/components/MapboxImages' },
{ text: 'MapboxLayer', link: '/components/MapboxLayer' },
{
text: 'MapboxNavigationControl',
Expand Down
21 changes: 11 additions & 10 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ Have a look at the [small guide](/guide/) for information on how to setup a simp

Check the detailed documentation on each components for a more advanced usage:

| Component | Description |
|---------------------------------------------------------|----------------------------------------------------------------------------------|
| [MapboxMap](./components/MapboxMap.md) | Display a map with the given style. |
| [MapboxMarker](./components/MapboxMarker.md) | Display a simple or custom marker. |
| [MapboxCluster](./components/MapboxCluster.md) | Display a GeoJSON as clusters. |
| Component | Description |
|--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| [MapboxMap](./components/MapboxMap.md) | Display a map with the given style. |
| [MapboxMarker](./components/MapboxMarker.md) | Display a simple or custom marker. |
| [MapboxCluster](./components/MapboxCluster.md) | Display a GeoJSON as clusters. |
| [MapboxGeocoder](./components/MapboxGeocoder.md) | Display a geocoder search input with the [@mapbox/mapbox-gl-geocoder](https://github.com/mapbox/mapbox-gl-geocoder) plugin. |
| [MapboxImage](./components/MapboxImage.md) | Load an image to be used on the map. |
| [MapboxLayer](./components/MapboxLayer.md) | Display a layer on the map. |
| [MapboxNavigationControl](./components/MapboxNavigationControl.md) | Display the map's navigation controls |
| [MapboxPopup](./components/MapboxPopup.md) | Display a popup on the map |
| [MapboxSource](./components/MapboxSource.md) | Load a source of data to be used on the map |
| [MapboxImage](./components/MapboxImage.md) | Load an image to be used on the map. |
| [MapboxImages](./components/MapboxImages.md) | Load multiple images to be used on the map. |
| [MapboxLayer](./components/MapboxLayer.md) | Display a layer on the map. |
| [MapboxNavigationControl](./components/MapboxNavigationControl.md) | Display the map's navigation controls |
| [MapboxPopup](./components/MapboxPopup.md) | Display a popup on the map |
| [MapboxSource](./components/MapboxSource.md) | Load a source of data to be used on the map |


## Note
Expand Down
111 changes: 110 additions & 1 deletion docs/components/MapboxImage.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,113 @@ next: ./MapboxLayer.md

# MapboxImage

...
Add an image to be used used in `icon-image`, `background-pattern`, `fill-pattern`, and `line-pattern`.

- [`addImage` documentation](https://docs.mapbox.com/mapbox-gl-js/api/#map#addimage)
- [Add an icon to the map example](https://docs.mapbox.com/mapbox-gl-js/example/add-image/)
- [Add a generated icon to the map](https://docs.mapbox.com/mapbox-gl-js/example/add-image-generated/)


<h2>Table of contents</h2>

[[toc]]

## Examples

### Add an icon to the map



<client-only>
<mapbox-map
style="margin-top: 1em; height: 400px;"
:access-token="MAPBOX_API_KEY"
map-style="mapbox://styles/mapbox/streets-v11"
:center="[0, 0]"
:zoom="1">
<mapbox-image
src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/60/Cat_silhouette.svg/400px-Cat_silhouette.svg.png"
id="cat">
<mapbox-layer
id="points"
:options="{
type: 'symbol',
source: {
type: 'geojson',
data: {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [0, 0]
}
}
]
}
},
layout: {
'icon-image': 'cat',
'icon-size': 0.25
}
}" />
</mapbox-image>
</mapbox-map>
</client-only>

```vue
<mapbox-map
style="height: 400px"
access-token="..."
map-style="mapbox://styles/mapbox/streets-v11"
:center="[0, 0]"
:zoom="1">
<mapbox-image
src="https://upload.wikimedia.org/wikipedia/commons/thumb/6/60/Cat_silhouette.svg/400px-Cat_silhouette.svg.png"
id="cat" />
</mapbox-map>
```

## Props

### `id`

- Type `String`
- Required `true`

The ID of the image. This will be used to refer to this image.

### `src`

- Type `[ String, HTMLImageElement, ImageData, Object ]`
- Required `true`

The image as String, an HTMLImageElement, ImageData, or object with width, height, and data properties with the same format as ImageData.

### `options`

- Type `Object`
- Default `{ pixelRatio: 1, sdf: false }`

This options object will be passed directly to the `addImage` method.

## Events

### `add`

Emitted when the image has been added to the map with the [`addImage`](https://docs.mapbox.com/mapbox-gl-js/api/#map#addimage) method.

**Properties**

- `image` _(`Object`)_ The image's informations
- `image.id` _(`String`)_ The ID given to the image
- `image.src` _(`HTMLImageElement | ImageData | Object`)_ The generated source of the image when the given source is a string; the given source otherwise
- `image.options` _(`Object`)_ The options object used with the `addImage` method


## Slots

### `default`

The default slot will be rendered _after_ the image has been added to the map — when the `add` event is emitted.
83 changes: 83 additions & 0 deletions docs/components/MapboxImages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
sidebar: auto
prev: ./MapboxGeocoder.md
next: ./MapboxLayer.md
---

# MapboxImage

Add multiple images at once to be used used in `icon-image`, `background-pattern`, `fill-pattern`, and `line-pattern`. This component is a wrapper around the [`MapboxImage`](./MapboxImage.md) component.

<h2>Table of contents</h2>

[[toc]]

## Examples

### Add multiple icons to the map

<client-only>
<mapbox-images-demo api-key="MAPBOX_API_KEY" />
</client-only>

<<< @/docs/.vuepress/components/MapboxImagesDemo.vue

## Props

### `sources`

- Type `Array`
- Required `true`

A list of images to add to the map.

### `source.id`

- Type `String`
- Required `true`

The ID of the image. This will be used to refer to this image.

### `source.src`

- Type `[ String, HTMLImageElement, ImageData, Object ]`
- Required `true`

The image as String, an HTMLImageElement, ImageData, or object with width, height, and data properties with the same format as ImageData.

### `source.options`

- Type `Object`
- Default `{ pixelRatio: 1, sdf: false }`

This options object will be passed directly to the `addImage` method.

## Events


### `add`

Emitted for each image being added to the map with the [`addImage`](https://docs.mapbox.com/mapbox-gl-js/api/#map#addimage) method.

**Properties**

- `image` _(`Object`)_ The image's informations, directly passed from the `add` event of the `MapboxImage component
- `image.id` _(`String`)_ The ID given to the image
- `image.src` _(`HTMLImageElement | ImageData | Object`)_ The generated source of the image when the given source is a string; the given source otherwise
- `image.options` _(`Object`)_ The options object used with the `addImage` method
- `index` _(`Number`)_ The index of the image which has been added
- `total` _(`Number`)_ The total number of images to add

### `ready`

Emitted when all images have been added to the map.

**Properties**

- `images` _(`Array`)_ An array containing all the added images' object emitted by the `add` event

## Slots

### `default`

The default slot will be rendered _after_ the images have been added to the map — when the `ready` event is emitted.
Loading

0 comments on commit 4eacc9c

Please sign in to comment.