Skip to content

Commit

Permalink
Merge 2fc4996 into 00f685b
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Aug 2, 2019
2 parents 00f685b + 2fc4996 commit 2765bff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"dependencies": {
"@babel/runtime": "^7.0.0",
"mapbox-gl": "^1.0.0",
"mjolnir.js": "^2.1.2",
"mjolnir.js": "^2.2.0",
"prop-types": "^15.7.2",
"react-virtualized-auto-sizer": "^1.0.2",
"viewport-mercator-project": "^6.1.0"
Expand Down
15 changes: 11 additions & 4 deletions src/components/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,18 @@ export default class Popup extends BaseControl<PopupProps, *, HTMLDivElement> {
evt.stopPropagation();
}

if (
evt.type === 'click' &&
(this.props.closeOnClick || evt.target.className === 'mapboxgl-popup-close-button')
) {
if (this.props.closeOnClick || evt.target.className === 'mapboxgl-popup-close-button') {
this.props.onClose();

const {eventManager} = this._context;
if (eventManager) {
// Using with InteractiveMap
// After we call `onClose` on `anyclick`, this component will be unmounted
// at which point we unregister the event listeners and stop blocking propagation.
// Then after a short delay a `click` event will fire
// Attach a one-time event listener here to prevent it from triggering `onClick` of the base map
eventManager.once('click', e => e.stopPropagation(), evt.target);
}
}
};

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6326,10 +6326,10 @@ mixin-deep@^1.2.0:
for-in "^1.0.2"
is-extendable "^1.0.1"

mjolnir.js@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/mjolnir.js/-/mjolnir.js-2.1.1.tgz#31025bc6e32608747eb8b86b312539860a661387"
integrity sha512-MxgCzhVT93HzERKV8bygkHzo6H0b1TQ2qFKh3h7q0i1r294+2dWFadACj/WxoYKweFFdhOhzmTHonJKsMvowjg==
mjolnir.js@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/mjolnir.js/-/mjolnir.js-2.2.0.tgz#3ca4a1e18321595e86bb9c8b5f68da8f5f68fcae"
integrity sha512-nh58odNDNms8TnajKU+BYYtiffIVsxe5yg4CP/rDwJWTrNKR38ULf5CdjMWkWFSsoocHL157yQH8PEuNNU0kvA==
dependencies:
"@babel/runtime" "^7.0.0"
hammerjs "^2.0.8"
Expand Down

0 comments on commit 2765bff

Please sign in to comment.