Skip to content
This repository was archived by the owner on Nov 30, 2018. It is now read-only.

Commit 3b82ee7

Browse files
authored
Merge pull request #1950 from AbstractVisions/patch-1
Return support Two-way binding map center defined as GeoJSON Point
2 parents c959085 + fb479b5 commit 3b82ee7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/coffee/directives/api/map.coffee

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,14 @@ angular.module('uiGmapgoogle-maps.directives.api')
142142

143143
updateCenter = (c = _gMap.center, s = scope) ->
144144
unless _.includes disabledEvents, 'center'
145-
s.center.latitude = c.lat() if s.center.latitude isnt c.lat()
146-
s.center.longitude = c.lng() if s.center.longitude isnt c.lng()
145+
cLat = c.lat()
146+
cLng = c.lng()
147+
if angular.isDefined(s.center.type)
148+
s.center.coordinates[1] = cLat if s.center.coordinates[1] isnt cLat
149+
s.center.coordinates[0] = cLng if s.center.coordinates[0] isnt cLng
150+
else
151+
s.center.latitude = cLat if s.center.latitude isnt cLat
152+
s.center.longitude = cLng if s.center.longitude isnt cLng
147153

148154
settingFromDirective = false
149155
maybeHookToEvent 'idle', ->

0 commit comments

Comments
 (0)