-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
18,449 additions
and
12,058 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Oops, something went wrong.