From 59298a72d07bc331226878bf5dce9c8430b01123 Mon Sep 17 00:00:00 2001 From: Madis Allikmaa Date: Tue, 7 Feb 2017 17:24:36 +0200 Subject: [PATCH] Docstrings: Fix popup "autoClose" and "closeOnClick" options, fixes #5040 (#5304) * Fix popup "autoClose" and "closeOnClick" options documentation, fixes #5040 * Docstring for Popup `closeOnClick` option * Backticks on docstrings --- docs/reference-1.0.0.html | 10 ++++++++-- docs/reference-1.0.2.html | 10 ++++++++-- docs/reference-1.0.3.html | 10 ++++++++-- src/layer/Popup.js | 9 ++++++--- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/docs/reference-1.0.0.html b/docs/reference-1.0.0.html index e2733eb7..fa0828b6 100644 --- a/docs/reference-1.0.0.html +++ b/docs/reference-1.0.0.html @@ -2916,13 +2916,19 @@ off of the screen while it is open. true Controls the presence of a close button in the popup. + + closeOnClick + Boolean + * + Set it if you want to override the default behavior of the popup closing when user clicks +on the map. Defaults to the Map's closePopupOnClick option. + autoClose Boolean true Set it to false if you want to override the default behavior of -the popup closing when user clicks the map (set globally by -the Map's closePopupOnClick option). +the popup closing when another popup is opened. className diff --git a/docs/reference-1.0.2.html b/docs/reference-1.0.2.html index d477b916..b4e3b6ff 100644 --- a/docs/reference-1.0.2.html +++ b/docs/reference-1.0.2.html @@ -2958,13 +2958,19 @@ off of the screen while it is open. true Controls the presence of a close button in the popup. + + closeOnClick + Boolean + * + Set it if you want to override the default behavior of the popup closing when user clicks +on the map. Defaults to the Map's closePopupOnClick option. + autoClose Boolean true Set it to false if you want to override the default behavior of -the popup closing when user clicks the map (set globally by -the Map's closePopupOnClick option). +the popup closing when another popup is opened. className diff --git a/docs/reference-1.0.3.html b/docs/reference-1.0.3.html index ccb8d84a..0f5fe48b 100644 --- a/docs/reference-1.0.3.html +++ b/docs/reference-1.0.3.html @@ -2967,13 +2967,19 @@ off of the screen while it is open. true Controls the presence of a close button in the popup. + + closeOnClick + Boolean + * + Set it if you want to override the default behavior of the popup closing when user clicks +on the map. Defaults to the Map's closePopupOnClick option. + autoClose Boolean true Set it to false if you want to override the default behavior of -the popup closing when user clicks the map (set globally by -the Map's closePopupOnClick option). +the popup closing when another popup is opened. className diff --git a/src/layer/Popup.js b/src/layer/Popup.js index 73f17898..1ae4b40f 100644 --- a/src/layer/Popup.js +++ b/src/layer/Popup.js @@ -84,10 +84,13 @@ export var Popup = DivOverlay.extend({ // @option autoClose: Boolean = true // Set it to `false` if you want to override the default behavior of - // the popup closing when user clicks the map (set globally by - // the Map's [closePopupOnClick](#map-closepopuponclick) option). + // the popup closing when another popup is opened. autoClose: true, + // @option closeOnClick: Boolean = * + // Set it if you want to override the default behavior of the popup closing when user clicks + // on the map. Defaults to the map's [`closePopupOnClick`](#map-closepopuponclick) option. + // @option className: String = '' // A custom CSS class name to assign to the popup. className: '' @@ -148,7 +151,7 @@ export var Popup = DivOverlay.extend({ getEvents: function () { var events = DivOverlay.prototype.getEvents.call(this); - if ('closeOnClick' in this.options ? this.options.closeOnClick : this._map.options.closePopupOnClick) { + if (this.options.closeOnClick !== undefined ? this.options.closeOnClick : this._map.options.closePopupOnClick) { events.preclick = this._close; }