@@ -70,7 +70,8 @@ angular.module("google-maps").directive "polygon", ["$log", "$timeout", ($log, $
70
70
replace : true
71
71
scope :
72
72
path : " =path"
73
- stroke : " =stroke"
73
+ stroke : " =stroke" ,
74
+ fill : " =fill" ,
74
75
clickable : " ="
75
76
draggable : " ="
76
77
editable : " ="
@@ -82,10 +83,10 @@ angular.module("google-maps").directive "polygon", ["$log", "$timeout", ($log, $
82
83
83
84
# Validate required properties
84
85
if angular .isUndefined (scope .path ) or scope .path is null or scope .path .length < 2 or not validatePathPoints (scope .path )
85
- $log .error " polyline : no valid path attribute found"
86
+ $log .error " polygon : no valid path attribute found"
86
87
return
87
88
88
- # Wrap polyline initialization inside a $timeout() call to make sure the map is created already
89
+ # Wrap polygon initialization inside a $timeout() call to make sure the map is created already
89
90
$timeout ->
90
91
map = mapCtrl .getMap ()
91
92
pathPoints = convertPathPoints (scope .path )
@@ -95,6 +96,8 @@ angular.module("google-maps").directive "polygon", ["$log", "$timeout", ($log, $
95
96
strokeColor : scope .stroke and scope .stroke .color
96
97
strokeOpacity : scope .stroke and scope .stroke .opacity
97
98
strokeWeight : scope .stroke and scope .stroke .weight
99
+ fillColor : scope .fill and scope .fill .color
100
+ fillOpacity : scope .fill and scope .fill .opacity
98
101
)
99
102
angular .forEach
100
103
clickable : true
@@ -108,24 +111,24 @@ angular.module("google-maps").directive "polygon", ["$log", "$timeout", ($log, $
108
111
else
109
112
opts[key] = scope[key]
110
113
111
- polyline = new google.maps.Polyline (opts)
114
+ polygon = new google.maps.Polygon (opts)
112
115
extendMapBounds map, pathPoints if isTrue (attrs .fit )
113
116
if angular .isDefined (scope .editable )
114
117
scope .$watch " editable" , (newValue , oldValue ) ->
115
- polyline .setEditable newValue
118
+ polygon .setEditable newValue
116
119
117
120
if angular .isDefined (scope .draggable )
118
121
scope .$watch " draggable" , (newValue , oldValue ) ->
119
- polyline .setDraggable newValue
122
+ polygon .setDraggable newValue
120
123
121
124
if angular .isDefined (scope .visible )
122
125
scope .$watch " visible" , (newValue , oldValue ) ->
123
- polyline .setVisible newValue
126
+ polygon .setVisible newValue
124
127
125
128
pathSetAtListener = undefined
126
129
pathInsertAtListener = undefined
127
130
pathRemoveAtListener = undefined
128
- polyPath = polyline .getPath ()
131
+ polyPath = polygon .getPath ()
129
132
pathSetAtListener = google .maps .event .addListener (polyPath, " set_at" , (index ) ->
130
133
value = polyPath .getAt (index)
131
134
return unless value
@@ -152,7 +155,7 @@ angular.module("google-maps").directive "polygon", ["$log", "$timeout", ($log, $
152
155
oldArray = polyline .getPath ()
153
156
if newArray isnt oldArray
154
157
if newArray
155
- polyline .setMap map
158
+ polygon .setMap map
156
159
i = 0
157
160
oldLength = oldArray .getLength ()
158
161
newLength = newArray .length
@@ -173,12 +176,12 @@ angular.module("google-maps").directive "polygon", ["$log", "$timeout", ($log, $
173
176
else
174
177
175
178
# Remove polyline
176
- polyline .setMap null
179
+ polygon .setMap null
177
180
), true
178
181
179
182
# Remove polyline on scope $destroy
180
183
scope .$on " $destroy" , ->
181
- polyline .setMap null
184
+ polygon .setMap null
182
185
pathSetAtListener ()
183
186
pathSetAtListener = null
184
187
pathInsertAtListener ()
@@ -187,4 +190,4 @@ angular.module("google-maps").directive "polygon", ["$log", "$timeout", ($log, $
187
190
pathRemoveAtListener = null
188
191
189
192
190
- ]
193
+ ]
0 commit comments