Skip to content

Commit

Permalink
Fix 645 - Draw feature, close menu
Browse files Browse the repository at this point in the history
  • Loading branch information
adube committed Sep 18, 2018
1 parent 4840a86 commit c30a04b
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions contribs/gmf/src/drawing/drawFeatureComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,8 @@ exports.Controller_ = function($scope, $timeout, gettextCatalog,
this.featureHelper_.panMapToFeature(newFeature, this.map);
this.listSelectionInProgress_ = false;
}
} else if (this.menu_) {
this.map.removeOverlay(this.menu_);
this.menu_ = null;
} else {
this.closeMenu_();
}
}
);
Expand All @@ -345,6 +344,18 @@ exports.Controller_ = function($scope, $timeout, gettextCatalog,
};


/**
* Close menu, if it exists.
* @private
*/
exports.Controller_.prototype.closeMenu_ = function() {
if (this.menu_) {
this.map.removeOverlay(this.menu_);
this.menu_ = null;
}
};


/**
* Initialize interactions by setting them inactive and decorating them
* @private
Expand Down Expand Up @@ -435,10 +446,7 @@ exports.Controller_.prototype.handleActiveChange_ = function(active) {
this.mapSelectActive = false;
this.selectedFeature = null;

if (this.menu_) {
this.map.removeOverlay(this.menu_);
this.menu_ = null;
}
this.closeMenu_();
}

};
Expand Down Expand Up @@ -645,6 +653,9 @@ exports.Controller_.prototype.handleMapContextMenu_ = function(evt) {

// show contextual menu when clicking on certain types of features
if (feature) {

this.closeMenu_();

let actions = [];

const type = this.featureHelper_.getType(feature);
Expand Down

0 comments on commit c30a04b

Please sign in to comment.