Skip to content

Commit

Permalink
fix issue with several events map-is-initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelgalkin committed Nov 22, 2017
1 parent 18c0a62 commit b4a7d99
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-yandex-maps",
"version": "0.5.4",
"version": "0.5.5",
"description": "Yandex Maps component for VueJS.",
"main": "vue-yandex-maps.js",
"jsnext:main": "./src/index.js",
Expand Down
5 changes: 4 additions & 1 deletion src/Marker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as utils from './utils';

export default {
props: {
coords: {
Expand Down Expand Up @@ -26,7 +28,8 @@ export default {
render() {
},
watch: {
coords() {
coords(newVal, oldVal) {
if (utils.objectComparison(newVal, oldVal)) { return; }
this.$ymapEventBus.initMap && this.$ymapEventBus.initMap();
}
}
Expand Down
12 changes: 9 additions & 3 deletions src/YMap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue from 'vue';
import * as utils from './utils'
import * as utils from './utils';

export default {
data() {
Expand Down Expand Up @@ -52,7 +52,12 @@ export default {
return ['map', 'satellite', 'hybrid'].includes(val)
}
},
placemarks: Array
placemarks: {
type: Array,
default() {
return [];
}
}
},
computed: {
coordinates() {
Expand Down Expand Up @@ -178,7 +183,8 @@ export default {
this.myMap.geoObjects.add(myGeoObjects);

utils.createClusters(markers, this.clusterOptions, this.myMap)
.then(() => this.$emit('map-was-initialized', this.myMap));

this.$emit('map-is-initialized', this.myMap)
}
},
watch: {
Expand Down
1 change: 0 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export function createClusters(markers, options, map) {
clusterer.add(clusters[clusterName]);
map.geoObjects.add(clusterer);
}
return Promise.resolve();
}

export function getIconPreset(marker) {
Expand Down

0 comments on commit b4a7d99

Please sign in to comment.