Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 363b586

Browse files
committedDec 7, 2017
Destroying scope should only remove its own defaults
1 parent ff994d4 commit 363b586

7 files changed

+41
-22
lines changed
 

‎dist/ui-leaflet.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* ui-leaflet 2.0.0 2016-10-21
2+
* ui-leaflet 2.0.0 2017-08-15
33
* ui-leaflet - An AngularJS directive to easily interact with Leaflet maps
44
* git: https://github.com/angular-ui/ui-leaflet
55
*/
@@ -134,7 +134,7 @@ angular.module('ui-leaflet', ['nemLogging']).directive('leaflet', ["$q", "leafle
134134
});
135135

136136
scope.$on('$destroy', function () {
137-
leafletMapDefaults.reset();
137+
leafletMapDefaults.reset(attrs.id);
138138
map.remove();
139139
leafletData.unresolveMap(attrs.id);
140140
});
@@ -1867,8 +1867,11 @@ angular.module('ui-leaflet').factory('leafletMapDefaults', ["$q", "leafletHelper
18671867

18681868
// Get the _defaults dictionary, and override the properties defined by the user
18691869
return {
1870-
reset: function reset() {
1871-
defaults = {};
1870+
reset: function reset(scopeId) {
1871+
if (!isDefined(scopeId)) {
1872+
scopeId = 'main';
1873+
}
1874+
delete defaults[scopeId];
18721875
},
18731876
getDefaults: function getDefaults(scopeId) {
18741877
var mapId = obtainEffectiveMapId(defaults, scopeId);
@@ -4802,7 +4805,12 @@ angular.module('ui-leaflet').factory('leafletEventsHelpersFactory', ["$rootScope
48024805
// Event propadation logic
48034806
if (isDefined(leafletScope.eventBroadcast[this.lObjectType].logic)) {
48044807
// We take care of possible propagation logic
4805-
if (leafletScope.eventBroadcast[_this.lObjectType].logic !== "emit" && leafletScope.eventBroadcast[_this.lObjectType].logic !== "broadcast") $log.warn(errorHeader + "Available event propagation logic are: 'emit' or 'broadcast'.");
4808+
var configuredLogic = leafletScope.eventBroadcast[_this.lObjectType].logic;
4809+
if (configuredLogic !== "emit" && configuredLogic !== "broadcast") {
4810+
$log.warn(errorHeader + "Available event propagation logic are: 'emit' or 'broadcast'.");
4811+
} else {
4812+
logic = configuredLogic;
4813+
}
48064814
}
48074815
// Enable / Disable
48084816
var eventsEnable = false,

‎dist/ui-leaflet.min.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/ui-leaflet.min.no-header.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/ui-leaflet_dev_mapped.js

+13-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/ui-leaflet_dev_mapped.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/directives/leaflet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ angular.module('ui-leaflet', ['nemLogging']).directive('leaflet',
135135
});
136136

137137
scope.$on('$destroy', function () {
138-
leafletMapDefaults.reset();
138+
leafletMapDefaults.reset(attrs.id);
139139
map.remove();
140140
leafletData.unresolveMap(attrs.id);
141141
});

‎src/services/leafletMapDefaults.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ angular.module('ui-leaflet').factory('leafletMapDefaults', function ($q, leaflet
4848

4949
// Get the _defaults dictionary, and override the properties defined by the user
5050
return {
51-
reset: function () {
52-
defaults = {};
51+
reset: function (scopeId) {
52+
if (!isDefined(scopeId)){
53+
scopeId = 'main';
54+
}
55+
delete defaults[scopeId];
5356
},
5457
getDefaults: function (scopeId) {
5558
var mapId = obtainEffectiveMapId(defaults, scopeId);

0 commit comments

Comments
 (0)
This repository has been archived.