mapbox-gl-vue
Advanced tools
Comparing version 1.8.2 to 1.9.0
@@ -443,2 +443,4 @@ /******/ (function(modules) { // webpackBootstrap | ||
addControls: function addControls(map) { | ||
var _this2 = this; | ||
//Nav Control | ||
@@ -454,2 +456,18 @@ if (this.navControl.show) { | ||
map.addControl(geolocate, this.geolocateControl.position); | ||
geolocate.on('geolocate', function (position) { | ||
_this2.$emit('geolocate-geolocate', geolocate, position); | ||
}); | ||
geolocate.on('trackuserlocationstart', function () { | ||
_this2.$emit('geolocate-trackuserlocationstart', geolocate); | ||
}); | ||
geolocate.on('trackuserlocationend', function () { | ||
_this2.$emit('geolocate-trackuserlocationend', geolocate); | ||
}); | ||
geolocate.on('error', function (positionError) { | ||
_this2.$emit('geolocate-error', geolocate, positionError); | ||
}); | ||
} | ||
@@ -544,2 +562,14 @@ | ||
}, | ||
geolocate: function geolocate(control, position) { | ||
console.log('User position: ' + position.coords.latitude + ', ' + position.coords.longitude); | ||
}, | ||
geolocateError: function geolocateError(control, positionError) { | ||
console.log(positionError); | ||
}, | ||
geolocateStart: function geolocateStart(control) { | ||
console.log('geolocate started'); | ||
}, | ||
geolocateEnd: function geolocateEnd(control) { | ||
console.log('geolocate ended'); | ||
}, | ||
addPopUp: function addPopUp(map, e) { | ||
@@ -546,0 +576,0 @@ var features = map.queryRenderedFeatures(e.point, { layers: ['points'] }); |
@@ -400,2 +400,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
addControls: function addControls(map) { | ||
var _this2 = this; | ||
//Nav Control | ||
@@ -411,2 +413,18 @@ if (this.navControl.show) { | ||
map.addControl(geolocate, this.geolocateControl.position); | ||
geolocate.on('geolocate', function (position) { | ||
_this2.$emit('geolocate-geolocate', geolocate, position); | ||
}); | ||
geolocate.on('trackuserlocationstart', function () { | ||
_this2.$emit('geolocate-trackuserlocationstart', geolocate); | ||
}); | ||
geolocate.on('trackuserlocationend', function () { | ||
_this2.$emit('geolocate-trackuserlocationend', geolocate); | ||
}); | ||
geolocate.on('error', function (positionError) { | ||
_this2.$emit('geolocate-error', geolocate, positionError); | ||
}); | ||
} | ||
@@ -413,0 +431,0 @@ |
{ | ||
"name": "mapbox-gl-vue", | ||
"version": "1.8.2", | ||
"version": "1.9.0", | ||
"description": "A Vue.js component for Mapbox GL js", | ||
@@ -5,0 +5,0 @@ "main": "dist/Mapbox.js", |
@@ -173,6 +173,14 @@ [![npm](https://img.shields.io/npm/dw/localeval.svg)](https://www.npmjs.com/package/mapbox-gl-vue) | ||
Events can be used by prepending `map-` to the beginning of the Mapbox event. For example for the Mapbox `click` event `@map-click` can be used. | ||
Map and control events can be used by adding a prefix introduced in the following table to the beginning of the Mapbox event name. | ||
All events are passed the `map` object and the event if it has one. | ||
| Object | Prefix | | ||
| ----- | ------ | | ||
| Map | `map-` | | ||
| GeolocateControl | `geolocate-` | | ||
For example for the Mapbox Map `click` event `@map-click` can be used and for the GeolocateControl geolocate event `@geolocate-geolocate` can be used. | ||
All events are passed the `map` or `control` object and the event or position object if it has one. | ||
Example: | ||
@@ -187,2 +195,4 @@ | ||
@map-click="mapClicked" | ||
@geolocate-error="geolocateError" | ||
@geolocate-geolocate="geolocate" | ||
> | ||
@@ -243,2 +253,8 @@ </mapbox> | ||
}, | ||
geolocateError(control, positionError) { | ||
console.log(positionError); | ||
}, | ||
geolocate(control, position) { | ||
console.log(`User position: ${position.coords.latitude}, ${position.coords.longitude}`); | ||
} | ||
} | ||
@@ -245,0 +261,0 @@ }); |
@@ -59,2 +59,14 @@ import Mapbox from './components/Mapbox.vue'; | ||
}, | ||
geolocate(control, position) { | ||
console.log(`User position: ${position.coords.latitude}, ${position.coords.longitude}`); | ||
}, | ||
geolocateError(control, positionError) { | ||
console.log(positionError); | ||
}, | ||
geolocateStart(control) { | ||
console.log('geolocate started'); | ||
}, | ||
geolocateEnd(control) { | ||
console.log('geolocate ended'); | ||
}, | ||
addPopUp(map, e) { | ||
@@ -61,0 +73,0 @@ const features = map.queryRenderedFeatures(e.point, { layers: ['points'] }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1365
408
220680
12