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

#19 - Default featureGroup should be assigned gracefully without overwriting existing attributes #20

Merged
merged 1 commit into from
Jun 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions dist/ui-leaflet-draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@
}
if (!isDefined(options.edit) || !isDefined(options.edit.featureGroup)) {
_optionsEditedInDirective = true;
angular.extend(options, {
edit: {
featureGroup: new L.FeatureGroup()
}
if (!isDefined(options.edit)) {
options.edit = {};
}
angular.extend(options.edit, {
featureGroup: new L.FeatureGroup()
});
$timeout(function() {
return _optionsEditedInDirective = false;
Expand Down
8 changes: 4 additions & 4 deletions src/drawDirective.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ angular.module('ui-leaflet')

if !isDefined(options.edit) or !isDefined(options.edit.featureGroup)
_optionsEditedInDirective = true
angular.extend options,
edit:
featureGroup: new L.FeatureGroup()

if !isDefined(options.edit)
options.edit = {}
angular.extend options.edit,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

featureGroup: new L.FeatureGroup()
$timeout -> _optionsEditedInDirective = false #skip extra digest due to above mod

_featureGroup = options.edit.featureGroup
Expand Down