Skip to content

Commit 5ea9f29

Browse files
committed
Perf improvements
1 parent 2afb4c7 commit 5ea9f29

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

build/scripts/ng-map.debug.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ angular.module('ngMap', []);
516516
CustomMarker.prototype = new google.maps.OverlayView();
517517

518518
CustomMarker.prototype.setContent = function(html, scope) {
519-
console.log('input html', html);
520519
this.el.innerHTML = html;
521520
this.el.style.position = 'absolute';
522521
this.el.style.top = 0;
@@ -566,7 +565,8 @@ angular.module('ngMap', []);
566565
};
567566

568567
CustomMarker.prototype.setZIndex = function(zIndex) {
569-
zIndex && (this.zIndex = zIndex); /* jshint ignore:line */
568+
if (zIndex === undefined) return;
569+
(this.zIndex !== zIndex) && (this.zIndex = zIndex); /* jshint ignore:line */
570570
(this.el.style.zIndex !== this.zIndex) && (this.el.style.zIndex = this.zIndex);
571571
};
572572

@@ -634,7 +634,7 @@ angular.module('ngMap', []);
634634
// Do we really need a timeout with $scope.$apply() here?
635635
setTimeout(function() { //apply contents, class, and location after it is compiled
636636

637-
scope.$watch('[' + varsToWatch.join(',') + ']', function() {
637+
scope.$watch('[' + varsToWatch.join(',') + ']', function(newVal, oldVal) {
638638
customMarker.setContent(orgHtml, scope);
639639
}, true);
640640

@@ -656,7 +656,7 @@ angular.module('ngMap', []);
656656

657657
});
658658

659-
console.log("custom-marker events", "events");
659+
console.log("custom-marker events", events);
660660
for (var eventName in events) { /* jshint ignore:line */
661661
google.maps.event.addDomListener(
662662
customMarker.el, eventName, events[eventName]);
@@ -691,6 +691,7 @@ angular.module('ngMap', []);
691691
restrict: 'E',
692692
require: ['?^map','?^ngMap'],
693693
compile: function(element) {
694+
console.log('el', element);
694695
setCustomMarker();
695696
element[0].style.display ='none';
696697
var orgHtml = element.html();

build/scripts/ng-map.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ angular.module('ngMap', []);
525525
CustomMarker.prototype = new google.maps.OverlayView();
526526

527527
CustomMarker.prototype.setContent = function(html, scope) {
528-
void 0;
529528
this.el.innerHTML = html;
530529
this.el.style.position = 'absolute';
531530
this.el.style.top = 0;
@@ -575,7 +574,8 @@ angular.module('ngMap', []);
575574
};
576575

577576
CustomMarker.prototype.setZIndex = function(zIndex) {
578-
zIndex && (this.zIndex = zIndex); /* jshint ignore:line */
577+
if (zIndex === undefined) return;
578+
(this.zIndex !== zIndex) && (this.zIndex = zIndex); /* jshint ignore:line */
579579
(this.el.style.zIndex !== this.zIndex) && (this.el.style.zIndex = this.zIndex);
580580
};
581581

@@ -643,7 +643,7 @@ angular.module('ngMap', []);
643643
// Do we really need a timeout with $scope.$apply() here?
644644
setTimeout(function() { //apply contents, class, and location after it is compiled
645645

646-
scope.$watch('[' + varsToWatch.join(',') + ']', function() {
646+
scope.$watch('[' + varsToWatch.join(',') + ']', function(newVal, oldVal) {
647647
customMarker.setContent(orgHtml, scope);
648648
}, true);
649649

@@ -700,6 +700,7 @@ angular.module('ngMap', []);
700700
restrict: 'E',
701701
require: ['?^map','?^ngMap'],
702702
compile: function(element) {
703+
void 0;
703704
setCustomMarker();
704705
element[0].style.display ='none';
705706
var orgHtml = element.html();

build/scripts/ng-map.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/scripts/ng-map.no-dependency.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ angular.module('ngMap', []);
525525
CustomMarker.prototype = new google.maps.OverlayView();
526526

527527
CustomMarker.prototype.setContent = function(html, scope) {
528-
void 0;
529528
this.el.innerHTML = html;
530529
this.el.style.position = 'absolute';
531530
this.el.style.top = 0;
@@ -575,7 +574,8 @@ angular.module('ngMap', []);
575574
};
576575

577576
CustomMarker.prototype.setZIndex = function(zIndex) {
578-
zIndex && (this.zIndex = zIndex); /* jshint ignore:line */
577+
if (zIndex === undefined) return;
578+
(this.zIndex !== zIndex) && (this.zIndex = zIndex); /* jshint ignore:line */
579579
(this.el.style.zIndex !== this.zIndex) && (this.el.style.zIndex = this.zIndex);
580580
};
581581

@@ -643,7 +643,7 @@ angular.module('ngMap', []);
643643
// Do we really need a timeout with $scope.$apply() here?
644644
setTimeout(function() { //apply contents, class, and location after it is compiled
645645

646-
scope.$watch('[' + varsToWatch.join(',') + ']', function() {
646+
scope.$watch('[' + varsToWatch.join(',') + ']', function(newVal, oldVal) {
647647
customMarker.setContent(orgHtml, scope);
648648
}, true);
649649

@@ -700,6 +700,7 @@ angular.module('ngMap', []);
700700
restrict: 'E',
701701
require: ['?^map','?^ngMap'],
702702
compile: function(element) {
703+
void 0;
703704
setCustomMarker();
704705
element[0].style.display ='none';
705706
var orgHtml = element.html();

directives/custom-marker.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
CustomMarker.prototype = new google.maps.OverlayView();
5858

5959
CustomMarker.prototype.setContent = function(html, scope) {
60-
console.log('input html', html);
6160
this.el.innerHTML = html;
6261
this.el.style.position = 'absolute';
6362
this.el.style.top = 0;
@@ -107,7 +106,8 @@
107106
};
108107

109108
CustomMarker.prototype.setZIndex = function(zIndex) {
110-
zIndex && (this.zIndex = zIndex); /* jshint ignore:line */
109+
if (zIndex === undefined) return;
110+
(this.zIndex !== zIndex) && (this.zIndex = zIndex); /* jshint ignore:line */
111111
(this.el.style.zIndex !== this.zIndex) && (this.el.style.zIndex = this.zIndex);
112112
};
113113

@@ -175,7 +175,7 @@
175175
// Do we really need a timeout with $scope.$apply() here?
176176
setTimeout(function() { //apply contents, class, and location after it is compiled
177177

178-
scope.$watch('[' + varsToWatch.join(',') + ']', function() {
178+
scope.$watch('[' + varsToWatch.join(',') + ']', function(newVal, oldVal) {
179179
customMarker.setContent(orgHtml, scope);
180180
}, true);
181181

@@ -197,7 +197,7 @@
197197

198198
});
199199

200-
console.log("custom-marker events", "events");
200+
console.log("custom-marker events", events);
201201
for (var eventName in events) { /* jshint ignore:line */
202202
google.maps.event.addDomListener(
203203
customMarker.el, eventName, events[eventName]);
@@ -232,6 +232,7 @@
232232
restrict: 'E',
233233
require: ['?^map','?^ngMap'],
234234
compile: function(element) {
235+
console.log('el', element);
235236
setCustomMarker();
236237
element[0].style.display ='none';
237238
var orgHtml = element.html();

0 commit comments

Comments
 (0)