forked from eva-hafermalz/gn-map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgn-poly.html
93 lines (79 loc) · 2.1 KB
/
gn-poly.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<link rel="import" href="../polymer/polymer.html">
<!--
The `gn-poly` element is used to add a polygon on `gn-map` element. `gn-point` elements are used to create the polygon.
Examples:
<gn-map
latitude="53.694089"
longitude="10.608718"
zoom="13" map-type="GoogleMap">
<gn-poly fill-color="red" stroke-color="red" closed>
<gn-point latitude="53.699089" longitude="10.603718"></gn-point>
<gn-point latitude="53.694089" longitude="10.608718"></gn-point>
<gn-point latitude="53.689089" longitude="10.603718"></gn-point>
<gn-point latitude="53.694089" longitude="10.598718"></gn-point>
</gn-poly>
</gn-map>
-->
<dom-module id="gn-poly">
<template>
<content></content>
</template>
<script>
Polymer({
is: "gn-poly",
properties: {
strokeColor: {
type: String,
value: '#0091ea',
notify: true
},
width: {
type: Number,
value: 4,
notify: true
},
closed: {
type: Boolean,
value: false,
notify: true
},
fillColor: {
type: String,
value: '#0091ea',
notify: true
},
points: {
type: Array,
notify: true,
value: function() {
return [];
}
},
fillOpacity: {
type: Number,
notify: true,
value: 0.5
}
},
asObject: function() {
return {
"strokeColor": this.strokeColor,
"width": this.width,
"closed": this.closed,
"fillColor": this.fillColor,
"fillOpacity": this.fillOpacity,
"points": this.points
}
},
attached: function () {
var self = this;
this._observer = Polymer.dom(this).observeNodes( function(info) {
self.queryAllEffectiveChildren('gn-point').forEach(function(point) {
self.push('points', point.asObject());
});
self.fire('update-gn-map');
});
}
});
</script>
</dom-module>