This repository was archived by the owner on Nov 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
issue 1328 circle scope updates again when events attr is not subscribed #1452
Merged
nmccready
merged 1 commit into
angular-ui:master
from
nmccready:dev/nmccready/issue_1328_scope_center_gets_updates
Aug 27, 2015
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,43 +42,42 @@ angular.module('uiGmapgoogle-maps.directives.api.models.parent') | |
| gObject | ||
|
|
||
| clean() | ||
| @listeners = @setEvents gObject, scope, scope, ['radius_changed'] | ||
| if @listeners? | ||
| @listeners.push google.maps.event.addListener gObject, 'radius_changed', -> | ||
| ### | ||
| possible google bug, and or because a circle has two radii | ||
| radius_changed appears to fire twice (original and new) which is not too helpful | ||
| therefore we will check for radius changes manually and bail out if nothing has changed | ||
| ### | ||
| @listeners = @setEvents(gObject, scope, scope, ['radius_changed']) or [] #or needed incase no-one is listening in controller | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. main problem here |
||
| @listeners.push google.maps.event.addListener gObject, 'radius_changed', -> | ||
| ### | ||
| possible google bug, and or because a circle has two radii | ||
| radius_changed appears to fire twice (original and new) which is not too helpful | ||
| therefore we will check for radius changes manually and bail out if nothing has changed | ||
| ### | ||
|
|
||
| newRadius = gObject.getRadius() | ||
| return if newRadius == lastRadius | ||
| newRadius = gObject.getRadius() | ||
| return if newRadius == lastRadius | ||
|
|
||
| lastRadius = newRadius | ||
| lastRadius = newRadius | ||
|
|
||
| work = -> | ||
| _settingFromDirective scope, -> | ||
| scope.radius = newRadius if newRadius != scope.radius | ||
| if scope.events?.radius_changed and _.isFunction scope.events?.radius_changed | ||
| scope.events.radius_changed(gObject, 'radius_changed', scope, arguments) | ||
| work = -> | ||
| _settingFromDirective scope, -> | ||
| scope.radius = newRadius if newRadius != scope.radius | ||
| if scope.events?.radius_changed and _.isFunction scope.events?.radius_changed | ||
| scope.events.radius_changed(gObject, 'radius_changed', scope, arguments) | ||
|
|
||
| # hack | ||
| # for some reason in specs I can not get $evalAsync to fire.. im tired of wasting time on this | ||
| if not angular.mock | ||
| scope.$evalAsync -> | ||
| work() | ||
| else | ||
| work() | ||
| if @listeners? | ||
| @listeners.push google.maps.event.addListener gObject, 'center_changed', -> | ||
| # hack | ||
| # for some reason in specs I can not get $evalAsync to fire.. im tired of wasting time on this | ||
| if not angular.mock | ||
| scope.$evalAsync -> | ||
| _settingFromDirective scope, -> | ||
| if angular.isDefined(scope.center.type) | ||
| scope.center.coordinates[1] = gObject.getCenter().lat() | ||
| scope.center.coordinates[0] = gObject.getCenter().lng() | ||
| else | ||
| scope.center.latitude = gObject.getCenter().lat() | ||
| scope.center.longitude = gObject.getCenter().lng() | ||
| work() | ||
| else | ||
| work() | ||
|
|
||
| @listeners.push google.maps.event.addListener gObject, 'center_changed', -> | ||
| scope.$evalAsync -> | ||
| _settingFromDirective scope, -> | ||
| if angular.isDefined(scope.center.type) | ||
| scope.center.coordinates[1] = gObject.getCenter().lat() | ||
| scope.center.coordinates[0] = gObject.getCenter().lng() | ||
| else | ||
| scope.center.latitude = gObject.getCenter().lat() | ||
| scope.center.longitude = gObject.getCenter().lng() | ||
|
|
||
|
|
||
| scope.$on '$destroy', => | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no event attribute set which without this fix was failing