Improve some nullable map types

Closes #13326
This commit is contained in:
EvertEt
2022-02-04 09:53:58 +01:00
parent 5cfb634d89
commit 15de4bb5ab
8 changed files with 22 additions and 17 deletions
+5 -4
View File
@@ -69,7 +69,7 @@ class Control extends BaseObject {
/**
* @private
* @type {import("../PluggableMap.js").default}
* @type {import("../PluggableMap.js").default|undefined|null}
*/
this.map_ = null;
@@ -98,7 +98,7 @@ class Control extends BaseObject {
/**
* Get the map associated with this control.
* @return {import("../PluggableMap.js").default|undefined} Map.
* @return {import("../PluggableMap.js").default|undefined|null} Map.
* @api
*/
getMap() {
@@ -107,9 +107,10 @@ class Control extends BaseObject {
/**
* Remove the control from its current map and attach it to the new map.
* Pass `null` to just remove the control from the current map.
* Subclasses may set up event handlers to get notified about changes to
* the map here.
* @param {import("../PluggableMap.js").default} [map] Map.
* @param {import("../PluggableMap.js").default|null} [map] Map.
* @api
*/
setMap(map) {
@@ -121,7 +122,7 @@ class Control extends BaseObject {
}
this.listenerKeys.length = 0;
this.map_ = map;
if (this.map_) {
if (map) {
const target = this.target_
? this.target_
: map.getOverlayContainerStopEvent();
+2 -1
View File
@@ -281,9 +281,10 @@ class FullScreen extends Control {
/**
* Remove the control from its current map and attach it to the new map.
* Pass `null` to just remove the control from the current map.
* Subclasses may set up event handlers to get notified about changes to
* the map here.
* @param {import("../PluggableMap.js").default} map Map.
* @param {import("../PluggableMap.js").default|null} map Map.
* @api
*/
setMap(map) {
+2 -1
View File
@@ -212,9 +212,10 @@ class MousePosition extends Control {
/**
* Remove the control from its current map and attach it to the new map.
* Pass `null` to just remove the control from the current map.
* Subclasses may set up event handlers to get notified about changes to
* the map here.
* @param {import("../PluggableMap.js").default} map Map.
* @param {import("../PluggableMap.js").default|null} map Map.
* @api
*/
setMap(map) {
+2 -1
View File
@@ -267,9 +267,10 @@ class OverviewMap extends Control {
/**
* Remove the control from its current map and attach it to the new map.
* Pass `null` to just remove the control from the current map.
* Subclasses may set up event handlers to get notified about changes to
* the map here.
* @param {import("../PluggableMap.js").default} map Map.
* @param {import("../PluggableMap.js").default|null} map Map.
* @api
*/
setMap(map) {
+2 -1
View File
@@ -161,9 +161,10 @@ class ZoomSlider extends Control {
/**
* Remove the control from its current map and attach it to the new map.
* Pass `null` to just remove the control from the current map.
* Subclasses may set up event handlers to get notified about changes to
* the map here.
* @param {import("../PluggableMap.js").default} map Map.
* @param {import("../PluggableMap.js").default|null} map Map.
* @api
*/
setMap(map) {