Skip to content
This repository was archived by the owner on Apr 7, 2020. It is now read-only.

Commit 4dcedc5

Browse files
authored
Merge pull request #20 from eugenehuanggy/overwritten_attributes
#19 - Default featureGroup should be assigned gracefully without overwriting existing attributes
2 parents 3987b69 + 8190f6e commit 4dcedc5

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

dist/ui-leaflet-draw.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,11 @@
107107
}
108108
if (!isDefined(options.edit) || !isDefined(options.edit.featureGroup)) {
109109
_optionsEditedInDirective = true;
110-
angular.extend(options, {
111-
edit: {
112-
featureGroup: new L.FeatureGroup()
113-
}
110+
if (!isDefined(options.edit)) {
111+
options.edit = {};
112+
}
113+
angular.extend(options.edit, {
114+
featureGroup: new L.FeatureGroup()
114115
});
115116
$timeout(function() {
116117
return _optionsEditedInDirective = false;

src/drawDirective.coffee

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ angular.module('ui-leaflet')
5959

6060
if !isDefined(options.edit) or !isDefined(options.edit.featureGroup)
6161
_optionsEditedInDirective = true
62-
angular.extend options,
63-
edit:
64-
featureGroup: new L.FeatureGroup()
65-
62+
if !isDefined(options.edit)
63+
options.edit = {}
64+
angular.extend options.edit,
65+
featureGroup: new L.FeatureGroup()
6666
$timeout -> _optionsEditedInDirective = false #skip extra digest due to above mod
6767

6868
_featureGroup = options.edit.featureGroup

0 commit comments

Comments
 (0)