Skip to content

Commit

Permalink
Merge pull request #2564 from WikiWatershed/cpc/fix-search-and-select
Browse files Browse the repository at this point in the history
Allow boundary selection after HUC search
  • Loading branch information
caseycesari authored Dec 21, 2017
2 parents 2d4ca15 + f593965 commit b83bdb8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mmw/js/src/draw/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ var DrawWindow = Marionette.LayoutView.extend({
this.rwdTaskModel.reset();
this.model.reset();

App.map.set('selectedGeocoderArea', null);

utils.cancelDrawing(App.getLeafletMap());

// RWD typically does not clear the AoI generated, even if it
Expand Down
10 changes: 10 additions & 0 deletions src/mmw/js/src/geocode/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ var SearchBoxView = Marionette.LayoutView.extend({
'click @ui.selectButton': 'validateShapeAndGoToAnalyze'
},

initialize: function() {
this.listenTo(App.map, 'change:selectedGeocoderArea', this.resetIfSelectedAreaIsCleared);
},

modelEvents: {
'change:query change:selectedSuggestion': 'render'
},
Expand Down Expand Up @@ -263,6 +267,12 @@ var SearchBoxView = Marionette.LayoutView.extend({
App.map.set('selectedGeocoderArea', null);
},

resetIfSelectedAreaIsCleared: function(model, selectedGeocoderArea) {
if (!selectedGeocoderArea) {
this.reset();
}
},

dismissAction: function() {
this.reset();
this.setStateDefault();
Expand Down

0 comments on commit b83bdb8

Please sign in to comment.