|
571 | 571 | this.doClick = doClick;
|
572 | 572 | this.gMarkerManager = gMarkerManager;
|
573 | 573 | this.watchDestroy = __bind(this.watchDestroy, this);
|
| 574 | + this.setLabelOptions = __bind(this.setLabelOptions, this); |
| 575 | + this.isLabelDefined = __bind(this.isLabelDefined, this); |
574 | 576 | this.setOptions = __bind(this.setOptions, this);
|
575 | 577 | this.setIcon = __bind(this.setIcon, this);
|
576 | 578 | this.setCoords = __bind(this.setCoords, this);
|
|
717 | 719 | }
|
718 | 720 | this.opts = this.createMarkerOptions(scope.coords, scope.icon, scope.options);
|
719 | 721 | delete this.gMarker;
|
720 |
| - if (scope.labelContent != null) { |
721 |
| - this.opts.labelAnchor = this.getLabelPositionPoint(scope.labelAnchor); |
722 |
| - this.opts.labelClass = scope.labelClass; |
723 |
| - this.opts.labelContent = scope.labelContent; |
724 |
| - this.gMarker = new MarkerWithLabel(this.opts); |
| 722 | + if (this.isLabelDefined(scope)) { |
| 723 | + this.gMarker = new MarkerWithLabel(this.setLabelOptions(this.opts, scope)); |
725 | 724 | } else {
|
726 | 725 | this.gMarker = new google.maps.Marker(this.opts);
|
727 | 726 | }
|
|
733 | 732 | });
|
734 | 733 | };
|
735 | 734 |
|
| 735 | + MarkerChildModel.prototype.isLabelDefined = function(scope) { |
| 736 | + return scope.labelContent != null; |
| 737 | + }; |
| 738 | + |
| 739 | + MarkerChildModel.prototype.setLabelOptions = function(opts, scope) { |
| 740 | + opts.labelAnchor = this.getLabelPositionPoint(scope.labelAnchor); |
| 741 | + opts.labelClass = scope.labelClass; |
| 742 | + opts.labelContent = scope.labelContent; |
| 743 | + return opts; |
| 744 | + }; |
| 745 | + |
736 | 746 | MarkerChildModel.prototype.watchDestroy = function(scope) {
|
737 | 747 | var _this = this;
|
738 | 748 | return scope.$on("$destroy", function() {
|
|
1249 | 1259 | _this.markers.push(child);
|
1250 | 1260 | return _this.markersIndex++;
|
1251 | 1261 | }, (function() {}), function() {
|
1252 |
| - scope.markerModels = _this.markers; |
1253 | 1262 | _this.gMarkerManager.draw();
|
1254 | 1263 | if (angular.isDefined(_this.attrs.fit) && (scope.fit != null) && scope.fit) {
|
1255 |
| - return _this.fit(); |
| 1264 | + _this.fit(); |
1256 | 1265 | }
|
| 1266 | + return scope.markerModels = _this.markers; |
1257 | 1267 | });
|
1258 | 1268 | };
|
1259 | 1269 |
|
|
0 commit comments