Skip to content

Commit e6584ab

Browse files
committed
Version 1.15.9
1 parent a2aa890 commit e6584ab

File tree

9 files changed

+74
-39
lines changed

9 files changed

+74
-39
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngmap",
3-
"version": "1.15.8",
3+
"version": "1.15.9",
44
"main": "./build/scripts/ng-map.js",
55
"homepage": "https://github.com/allenhwkim/angularjs-google-maps",
66
"authors": [

build/docs/NgMap.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ <h5>Parameters:</h5>
265265
</dd>
266266
</dl><dl>
267267
<dt>
268-
<a href="source/NgMap.html#line98" class="name-link">
268+
<a href="source/NgMap.html#line100" class="name-link">
269269
<h4 class="name">
270270
getGeoLocation
271271
<span class="signature">(address, options)</span>
@@ -390,7 +390,7 @@ <h5>Parameters:</h5>
390390
</dd>
391391
</dl><dl>
392392
<dt>
393-
<a href="source/NgMap.html#line133" class="name-link">
393+
<a href="source/NgMap.html#line135" class="name-link">
394394
<h4 class="name">
395395
observeAndSet
396396
<span class="signature">(attrName, object)</span>
@@ -441,7 +441,7 @@ <h5>Returns:</h5>
441441
</dd>
442442
</dl><dl>
443443
<dt>
444-
<a href="source/NgMap.html#line187" class="name-link">
444+
<a href="source/NgMap.html#line189" class="name-link">
445445
<h4 class="name">
446446
setDefaultOptions
447447
<span class="signature">(options)</span>
@@ -481,7 +481,7 @@ <h5>Parameters:</h5>
481481
</dd>
482482
</dl><dl>
483483
<dt>
484-
<a href="source/NgMap.html#line162" class="name-link">
484+
<a href="source/NgMap.html#line164" class="name-link">
485485
<h4 class="name">
486486
setStyle
487487
<span class="signature">(map)</span>

build/docs/source/NgMap.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,11 @@ <h1 class="title">
252252
var deleteMap = function(mapCtrl) {
253253
var len = Object.keys(mapControllers).length - 1;
254254
var mapId = mapCtrl.map.id || len;
255-
mapCtrl.map.controls.forEach(function(ctrl) {
256-
ctrl.clear();
257-
});
255+
if (typeof mapCtrl.map.controls != "undefined") {
256+
mapCtrl.map.controls.forEach(function(ctrl) {
257+
ctrl.clear();
258+
});
259+
}
258260
//delete mapCtrl.map;
259261
delete mapControllers[mapId];
260262
};

build/docs/source/custom-control.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ <h1 class="title">
220220
mapController.addObject('customControls', customControlEl);
221221
var position = options.position;
222222
mapController.map.controls[google.maps.ControlPosition[position]].push(customControlEl);
223+
element.bind('$destroy', function() {
224+
mapController.deleteObject('customControls', customControlEl);
225+
});
223226
};
224227
var customControl = function(Attr2MapOptions, _$compile_, _NgMap_) {
225228
parser = Attr2MapOptions, $compile = _$compile_, NgMap = _NgMap_;

build/docs/source/ngmap.custom-marker.html

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ <h1 class="title">
205205
options = options || {};
206206
this.el = document.createElement('div');
207207
this.el.style.display = 'inline-block';
208+
this.el.style.visibility = "hidden";
208209
this.visible = true;
209210
for (var key in options) { /* jshint ignore:line */
210211
this[key] = options[key];
@@ -232,10 +233,15 @@ <h1 class="title">
232233
position && (this.position = position); /* jshint ignore:line */
233234
if (this.getProjection() && typeof this.position.lng == 'function') {
234235
var posPixel = this.getProjection().fromLatLngToDivPixel(this.position);
235-
var x = Math.round(posPixel.x - (this.el.offsetWidth/2));
236-
var y = Math.round(posPixel.y - this.el.offsetHeight - 10); // 10px for anchor
237-
this.el.style.left = x + "px";
238-
this.el.style.top = y + "px";
236+
//delayed left/top calculation. with/height are not set instantly
237+
var _this = this;
238+
$timeout(function() {
239+
var x = Math.round(posPixel.x - (_this.el.offsetWidth/2));
240+
var y = Math.round(posPixel.y - _this.el.offsetHeight - 10); // 10px for anchor
241+
_this.el.style.left = x + "px";
242+
_this.el.style.top = y + "px";
243+
_this.el.style.visibility = "visible";
244+
}, 300);
239245
}
240246
};
241247
CustomMarker.prototype.setZIndex = function(zIndex) {
@@ -281,18 +287,18 @@ <h1 class="title">
281287
/**
282288
* build a custom marker element
283289
*/
284-
var removedEl = element[0].parentElement.removeChild(element[0]);
290+
element[0].style.display = 'none';
285291
console.log("custom-marker options", options);
286292
var customMarker = new CustomMarker(options);
287293
$timeout(function() { //apply contents, class, and location after it is compiled
288294
scope.$watch('[' + varsToWatch.join(',') + ']', function() {
289295
customMarker.setContent(orgHtml, scope);
290296
});
291-
customMarker.setContent(removedEl.innerHTML, scope);
292-
var classNames = removedEl.firstElementChild.className;
297+
customMarker.setContent(element[0].innerHTML, scope);
298+
var classNames = element[0].firstElementChild.className;
293299
customMarker.addClass('custom-marker');
294300
customMarker.addClass(classNames);
295-
console.log('customMarker', customMarker);
301+
console.log('customMarker', customMarker, 'classNames', classNames);
296302
if (!(options.position instanceof google.maps.LatLng)) {
297303
NgMap.getGeoLocation(options.position).then(
298304
function(latlng) {

build/scripts/ng-map.debug.js

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ angular.module('ngMap', []);
5757
var objs = obj.map[groupName];
5858
for (var name in objs) {
5959
if (objs[name] === obj) {
60+
console.log('Deleting', groupName, obj);
6061
google.maps.event.clearInstanceListeners(obj);
6162
delete objs[name];
6263
}
@@ -360,6 +361,9 @@ angular.module('ngMap', []);
360361
var position = options.position;
361362
mapController.map.controls[google.maps.ControlPosition[position]].push(customControlEl);
362363

364+
element.bind('$destroy', function() {
365+
mapController.deleteObject('customControls', customControlEl);
366+
});
363367
};
364368

365369
var customControl = function(Attr2MapOptions, _$compile_, _NgMap_) {
@@ -412,6 +416,7 @@ angular.module('ngMap', []);
412416

413417
this.el = document.createElement('div');
414418
this.el.style.display = 'inline-block';
419+
this.el.style.visibility = "hidden";
415420
this.visible = true;
416421
for (var key in options) { /* jshint ignore:line */
417422
this[key] = options[key];
@@ -446,10 +451,15 @@ angular.module('ngMap', []);
446451
position && (this.position = position); /* jshint ignore:line */
447452
if (this.getProjection() && typeof this.position.lng == 'function') {
448453
var posPixel = this.getProjection().fromLatLngToDivPixel(this.position);
449-
var x = Math.round(posPixel.x - (this.el.offsetWidth/2));
450-
var y = Math.round(posPixel.y - this.el.offsetHeight - 10); // 10px for anchor
451-
this.el.style.left = x + "px";
452-
this.el.style.top = y + "px";
454+
//delayed left/top calculation. with/height are not set instantly
455+
var _this = this;
456+
$timeout(function() {
457+
var x = Math.round(posPixel.x - (_this.el.offsetWidth/2));
458+
var y = Math.round(posPixel.y - _this.el.offsetHeight - 10); // 10px for anchor
459+
_this.el.style.left = x + "px";
460+
_this.el.style.top = y + "px";
461+
_this.el.style.visibility = "visible";
462+
}, 300);
453463
}
454464
};
455465

@@ -506,7 +516,7 @@ angular.module('ngMap', []);
506516
/**
507517
* build a custom marker element
508518
*/
509-
var removedEl = element[0].parentElement.removeChild(element[0]);
519+
element[0].style.display = 'none';
510520
console.log("custom-marker options", options);
511521
var customMarker = new CustomMarker(options);
512522

@@ -515,11 +525,11 @@ angular.module('ngMap', []);
515525
customMarker.setContent(orgHtml, scope);
516526
});
517527

518-
customMarker.setContent(removedEl.innerHTML, scope);
519-
var classNames = removedEl.firstElementChild.className;
528+
customMarker.setContent(element[0].innerHTML, scope);
529+
var classNames = element[0].firstElementChild.className;
520530
customMarker.addClass('custom-marker');
521531
customMarker.addClass(classNames);
522-
console.log('customMarker', customMarker);
532+
console.log('customMarker', customMarker, 'classNames', classNames);
523533

524534
if (!(options.position instanceof google.maps.LatLng)) {
525535
NgMap.getGeoLocation(options.position).then(
@@ -2901,9 +2911,11 @@ angular.module('ngMap', []);
29012911
var deleteMap = function(mapCtrl) {
29022912
var len = Object.keys(mapControllers).length - 1;
29032913
var mapId = mapCtrl.map.id || len;
2904-
mapCtrl.map.controls.forEach(function(ctrl) {
2905-
ctrl.clear();
2906-
});
2914+
if (typeof mapCtrl.map.controls != "undefined") {
2915+
mapCtrl.map.controls.forEach(function(ctrl) {
2916+
ctrl.clear();
2917+
});
2918+
}
29072919
//delete mapCtrl.map;
29082920
delete mapControllers[mapId];
29092921
};

build/scripts/ng-map.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ angular.module('ngMap', []);
5757
var objs = obj.map[groupName];
5858
for (var name in objs) {
5959
if (objs[name] === obj) {
60+
void 0;
6061
google.maps.event.clearInstanceListeners(obj);
6162
delete objs[name];
6263
}
@@ -360,6 +361,9 @@ angular.module('ngMap', []);
360361
var position = options.position;
361362
mapController.map.controls[google.maps.ControlPosition[position]].push(customControlEl);
362363

364+
element.bind('$destroy', function() {
365+
mapController.deleteObject('customControls', customControlEl);
366+
});
363367
};
364368

365369
var customControl = function(Attr2MapOptions, _$compile_, _NgMap_) {
@@ -412,6 +416,7 @@ angular.module('ngMap', []);
412416

413417
this.el = document.createElement('div');
414418
this.el.style.display = 'inline-block';
419+
this.el.style.visibility = "hidden";
415420
this.visible = true;
416421
for (var key in options) { /* jshint ignore:line */
417422
this[key] = options[key];
@@ -446,10 +451,15 @@ angular.module('ngMap', []);
446451
position && (this.position = position); /* jshint ignore:line */
447452
if (this.getProjection() && typeof this.position.lng == 'function') {
448453
var posPixel = this.getProjection().fromLatLngToDivPixel(this.position);
449-
var x = Math.round(posPixel.x - (this.el.offsetWidth/2));
450-
var y = Math.round(posPixel.y - this.el.offsetHeight - 10); // 10px for anchor
451-
this.el.style.left = x + "px";
452-
this.el.style.top = y + "px";
454+
//delayed left/top calculation. with/height are not set instantly
455+
var _this = this;
456+
$timeout(function() {
457+
var x = Math.round(posPixel.x - (_this.el.offsetWidth/2));
458+
var y = Math.round(posPixel.y - _this.el.offsetHeight - 10); // 10px for anchor
459+
_this.el.style.left = x + "px";
460+
_this.el.style.top = y + "px";
461+
_this.el.style.visibility = "visible";
462+
}, 300);
453463
}
454464
};
455465

@@ -506,7 +516,7 @@ angular.module('ngMap', []);
506516
/**
507517
* build a custom marker element
508518
*/
509-
var removedEl = element[0].parentElement.removeChild(element[0]);
519+
element[0].style.display = 'none';
510520
void 0;
511521
var customMarker = new CustomMarker(options);
512522

@@ -515,8 +525,8 @@ angular.module('ngMap', []);
515525
customMarker.setContent(orgHtml, scope);
516526
});
517527

518-
customMarker.setContent(removedEl.innerHTML, scope);
519-
var classNames = removedEl.firstElementChild.className;
528+
customMarker.setContent(element[0].innerHTML, scope);
529+
var classNames = element[0].firstElementChild.className;
520530
customMarker.addClass('custom-marker');
521531
customMarker.addClass(classNames);
522532
void 0;
@@ -2899,9 +2909,11 @@ angular.module('ngMap', []);
28992909
var deleteMap = function(mapCtrl) {
29002910
var len = Object.keys(mapControllers).length - 1;
29012911
var mapId = mapCtrl.map.id || len;
2902-
mapCtrl.map.controls.forEach(function(ctrl) {
2903-
ctrl.clear();
2904-
});
2912+
if (typeof mapCtrl.map.controls != "undefined") {
2913+
mapCtrl.map.controls.forEach(function(ctrl) {
2914+
ctrl.clear();
2915+
});
2916+
}
29052917
//delete mapCtrl.map;
29062918
delete mapControllers[mapId];
29072919
};

build/scripts/ng-map.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngmap",
3-
"version": "1.15.8",
3+
"version": "1.15.9",
44
"main": "build/scripts/ng-map.js",
55
"dependencies": {},
66
"engines": {

0 commit comments

Comments
 (0)