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

Commit

Permalink
Merge branch 'feature/issue_113' into r1-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nmccready committed Sep 6, 2013
2 parents d61c9ff + 1d41c39 commit e5f287f
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 43 deletions.
50 changes: 27 additions & 23 deletions dist/angular-google-maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@
content: content,
position: angular.isObject(gMarker) ? gMarker.getPosition() : new google.maps.LatLng(scope.coords.latitude, scope.coords.longitude)
});
}
},
defaultDelay: 50
};
});

Expand Down Expand Up @@ -883,6 +884,8 @@
var self,
_this = this;
self = this;
this.scope = scope;
this.element = element;
if (this.validateScope(scope)) {
return;
}
Expand Down Expand Up @@ -1001,22 +1004,24 @@
this.onDestroy = __bind(this.onDestroy, this);
this.onWatch = __bind(this.onWatch, this);
this.validateScope = __bind(this.validateScope, this);
var opts, self,
var self,
_this = this;
MarkerParentModel.__super__.constructor.call(this, scope, element, attrs, mapCtrl, $timeout);
self = this;
opts = this.createMarkerOptions(scope.coords, scope.icon, scope.options, mapCtrl.getMap());
this.gMarker = new google.maps.Marker(opts);
element.data('instance', this.gMarker);
this.scope = scope;
google.maps.event.addListener(this.gMarker, 'click', function() {
if (_this.doClick && (scope.click != null)) {
return $timeout(function() {
return _this.scope.click();
});
}
});
this.$log.info(this);
$timeout(function() {
var opts;
opts = _this.createMarkerOptions(_this.scope.coords, _this.scope.icon, _this.scope.options, _this.mapCtrl.getMap());
_this.gMarker = new google.maps.Marker(opts);
_this.element.data('instance', _this.gMarker);
google.maps.event.addListener(_this.gMarker, 'click', function() {
if (_this.doClick && (scope.click != null)) {
return $timeout(function() {
return _this.scope.click();
});
}
});
return _this.$log.info(_this);
}, directives.api.utils.GmapUtil.defaultDelay);
}

MarkerParentModel.prototype.validateScope = function(scope) {
Expand Down Expand Up @@ -1096,6 +1101,7 @@
this.gMarkerManager = void 0;
this.scope = scope;
this.bigGulp = directives.api.utils.AsyncProcessor;
this.$timeout = $timeout;
this.$log.info(this);
}

Expand Down Expand Up @@ -1507,13 +1513,11 @@
};
}

IMarker.prototype.controller = {
controller: [
'$scope', '$element', function($scope, $element) {
throw new Exception("Not Implemented!!");
}
]
};
IMarker.prototype.controller = [
'$scope', '$element', function($scope, $element) {
throw new Exception("Not Implemented!!");
}
];

IMarker.prototype.link = function(scope, element, attrs, ctrl) {
throw new Exception("Not implemented!!");
Expand Down Expand Up @@ -1612,7 +1616,7 @@
return scope.$on("$destroy", function() {
return label.destroy();
});
}, 50);
}, directives.api.utils.GmapUtil.defaultDelay + 25);
};

return Label;
Expand Down Expand Up @@ -1762,7 +1766,7 @@ not 1:1 in this setting.
return scope.$on("$destroy", function() {
return window.destroy();
});
}, 50);
}, directives.api.utils.GmapUtil.defaultDelay + 25);
};

return Window;
Expand Down
8 changes: 4 additions & 4 deletions dist/angular-google-maps.min.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions example/example-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,17 @@ function ExampleController ($scope, $timeout, $log) {
genRandomMarkers(numberOfMarkers,$scope);
}

$scope.searchLocation = {
latitude: 30.1451,
longitude: -99.6680
};
$scope.onMarkerClicked = onMarkerClicked

$timeout(function () {
// $scope.searchLocation = {
// latitude: 30.0,
// longitude: -100
// };
$scope.map.infoWindow.show = true;
dynamicMarkers = [
{
Expand Down
2 changes: 2 additions & 0 deletions example/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ <h1>angular-google-maps example</h1>

<trafficlayer show="map.showTraffic" />

<marker coords="searchLocation">
</marker>
<markers models="map.randomMarkers" coords="'self'" icon="'icon'" click="'onClicked'" doCluster="true">
</markers>

Expand Down
2 changes: 1 addition & 1 deletion src/coffee/directives/api/i-marker.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
click: '&click',
options: '=options'
}
controller: controller: ['$scope','$element', ($scope, $element) ->
controller: ['$scope','$element', ($scope, $element) ->
throw new Exception("Not Implemented!!")
]
link: (scope, element, attrs, ctrl) =>
Expand Down
2 changes: 1 addition & 1 deletion src/coffee/directives/api/label.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
scope.$on("$destroy", =>
label.destroy()
)
,50)
,directives.api.utils.GmapUtil.defaultDelay + 25)
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

constructor: (scope, element, attrs, mapCtrl,$timeout) ->
self = @
@scope = scope
@element = element
# Validate required properties
if (@validateScope(scope))
return
Expand Down
25 changes: 13 additions & 12 deletions src/coffee/directives/api/models/parent/marker-parent-model.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@
constructor: (scope, element, attrs, mapCtrl,$timeout) ->
super(scope, element, attrs, mapCtrl,$timeout)
self = @
opts = @createMarkerOptions(scope.coords,scope.icon,scope.options,mapCtrl.getMap())
#using scope.$id as the identifier for a marker as scope.$id should be unique, no need for an index (as it is the index)
@gMarker = new google.maps.Marker(opts)
element.data('instance', @gMarker)
@scope = scope
google.maps.event.addListener(@gMarker, 'click', =>
if @doClick and scope.click?
$timeout( =>
@scope.click()
)
)
@$log.info(@)
$timeout( =>
opts = @createMarkerOptions(@scope.coords,@scope.icon,@scope.options,@mapCtrl.getMap())
#using scope.$id as the identifier for a marker as scope.$id should be unique, no need for an index (as it is the index)
@gMarker = new google.maps.Marker(opts)
@element.data('instance', @gMarker)
google.maps.event.addListener(@gMarker, 'click', =>
if @doClick and scope.click?
$timeout( =>
@scope.click()
)
)
@$log.info(@)
,directives.api.utils.GmapUtil.defaultDelay)

validateScope:(scope)=>
super(scope) or angular.isUndefined(scope.coords.latitude) or angular.isUndefined(scope.coords.longitude)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@gMarkerManager = undefined
@scope = scope
@bigGulp = directives.api.utils.AsyncProcessor
@$timeout = $timeout
@$log.info(@)

onTimeOut:(scope)=>
Expand Down
4 changes: 3 additions & 1 deletion src/coffee/directives/api/utils/gmap-util.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@
gMarker.getPosition()
else
new google.maps.LatLng(scope.coords.latitude, scope.coords.longitude)
})
})

defaultDelay:50
2 changes: 1 addition & 1 deletion src/coffee/directives/api/window.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
scope.$on("$destroy", =>
window.destroy()
)
,50)
,directives.api.utils.GmapUtil.defaultDelay + 25)

0 comments on commit e5f287f

Please sign in to comment.