Skip to content

Commit

Permalink
Merge pull request #5557 from camptocamp/GSGMF-1221
Browse files Browse the repository at this point in the history
Don't close contextualdata if the user click the popup itself
  • Loading branch information
fredj committed Feb 24, 2020
2 parents 12e416b + c07bce1 commit 7cf765a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions contribs/gmf/src/contextualdata/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,15 @@ export function ContextualdataController($compile, $timeout, $scope, gmfRaster,
this.gmfContextualdataOptions_ = $injector.has('gmfContextualdataOptions') ?
$injector.get('gmfContextualdataOptions') : {};

document.body.addEventListener('mousedown', () => {
this.$scope_.$apply(() => {
this.hidePopover();
});
document.body.addEventListener('mousedown', event => {
const element = this.overlay_.getElement();
const target = /** @type {Node} */ (event.target);
// don't close if the user click the popup itself. this allows the text to be copied.
if (!element.contains(target)) {
this.$scope_.$apply(() => {
this.hidePopover();
});
}
});
}

Expand Down

0 comments on commit 7cf765a

Please sign in to comment.