Skip to content

Commit 8b9c38a

Browse files
committed
Copied changes from "NathanAP/vue-google-maps-community-fork"
1 parent aa47872 commit 8b9c38a

File tree

5 files changed

+25
-32
lines changed

5 files changed

+25
-32
lines changed

src/components/heatmap.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@ const props = {
44
options: {
55
type: Object,
66
twoWay: false,
7-
default: () => {
8-
},
7+
default: () => {},
98
},
109
data: {
1110
type: Array,
12-
twoWay: true
11+
twoWay: true,
1312
},
1413
}
1514

16-
const events = [];
15+
const events = []
1716

1817
export default buildComponent({
1918
mappedProps: props,
2019
name: 'heatmap',
2120
ctr: () => google.maps.visualization.HeatmapLayer,
2221
events,
2322
})
24-
25-

src/components/infoWindow.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,16 @@ export default buildComponent({
6767
this.$infoWindowObject.close()
6868
if (this.opened) {
6969
this.$infoWindowObject.open(this.$map, this.$markerObject)
70-
} else {
71-
this.$emit('closeclick')
7270
}
7371
},
7472
},
7573
7674
afterCreate() {
7775
this._openInfoWindow()
76+
this.$infoWindowObject.addListener('closeclick', () => {
77+
this.$emit('closeclick')
78+
this.$infoWindowObject.open(this.$map, this.$markerObject)
79+
})
7880
this.$watch('opened', () => {
7981
this._openInfoWindow()
8082
})

src/components/polygon.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
import buildComponent from './build-component.js'
23

34
const props = {
@@ -34,6 +35,7 @@ const events = [
3435
'mouseover',
3536
'mouseup',
3637
'rightclick',
38+
'paths_changed',
3739
]
3840

3941
export default buildComponent({
@@ -43,20 +45,23 @@ export default buildComponent({
4345
default: false,
4446
},
4547
},
46-
mappedProps: props,
4748
events,
48-
emits: events,
49-
49+
mappedProps: props,
5050
name: 'polygon',
5151
ctr: () => google.maps.Polygon,
52-
52+
emits: events,
5353
beforeCreate(options) {
5454
if (!options.path) delete options.path
5555
if (!options.paths) delete options.paths
5656
},
5757

5858
afterCreate(inst) {
5959
let clearEvents = () => {}
60+
events.forEach((event) => {
61+
inst.addListener(event, (payload) => {
62+
this.$emit(event, payload)
63+
})
64+
})
6065

6166
// Watch paths, on our own, because we do not want to set either when it is
6267
// empty
@@ -128,11 +133,5 @@ export default buildComponent({
128133
immediate: true,
129134
}
130135
)
131-
132-
events.forEach((event) => {
133-
inst.addListener(event, (payload) => {
134-
this.$emit(event, payload)
135-
})
136-
})
137136
},
138137
})

src/components/polyline.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,27 @@ const events = [
3232
]
3333

3434
export default buildComponent({
35+
mappedProps: props,
3536
props: {
3637
deepWatch: {
3738
type: Boolean,
3839
default: false,
3940
},
4041
},
41-
mappedProps: props,
4242
events,
43-
emits: events,
4443

4544
name: 'polyline',
4645
ctr: () => google.maps.Polyline,
47-
48-
beforeCreate(options) {
49-
if (!options.path) delete options.path
50-
},
51-
46+
emits: events,
5247
afterCreate(inst) {
5348
let clearEvents = () => {}
5449

50+
events.forEach((event) => {
51+
inst.addListener(event, (payload) => {
52+
this.$emit(event, payload)
53+
})
54+
})
55+
5556
this.$watch(
5657
'path',
5758
(path) => {
@@ -83,11 +84,5 @@ export default buildComponent({
8384
immediate: true,
8485
}
8586
)
86-
87-
events.forEach((event) => {
88-
inst.addListener(event, (payload) => {
89-
this.$emit(event, payload)
90-
})
91-
})
9287
},
9388
})

src/components/rectangle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ export default buildComponent({
4545
this.$emit(event, payload)
4646
})
4747
})
48-
}
48+
}
4949
})

0 commit comments

Comments
 (0)