commited for presentation.
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
*/
|
||||
export class MapList {
|
||||
constructor(active = null, maps = {}) {
|
||||
this.maps = maps
|
||||
this.active = active
|
||||
this._maps = maps
|
||||
this._active = active
|
||||
|
||||
if (Object.keys(maps).length > 0) this.select(active)
|
||||
}
|
||||
@@ -37,7 +37,7 @@ export class MapList {
|
||||
}
|
||||
|
||||
if (this.active !== active) {
|
||||
this.active = active
|
||||
this._active = active
|
||||
map = this.maps[active]
|
||||
}
|
||||
} else {
|
||||
@@ -75,7 +75,7 @@ export class MapList {
|
||||
*/
|
||||
add(key, map) {
|
||||
if (this.maps[key] != null) consol.warn('Key already in mapList. The existing key was overwritten.')
|
||||
if (this.active == null) this.active = key
|
||||
if (this.active == null) this._active = key
|
||||
map.name = key
|
||||
this.maps[key] = map
|
||||
}
|
||||
@@ -86,12 +86,35 @@ export class MapList {
|
||||
*
|
||||
*@public
|
||||
* @readonly
|
||||
* @member {GeoMap}
|
||||
* @memberof MapList
|
||||
*/
|
||||
get map() {
|
||||
return this.maps && this.maps[this.active] ? this.maps[this.active] : null
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of addedd cards.
|
||||
*
|
||||
* @member {object}
|
||||
* @readonly
|
||||
* @memberof MapList
|
||||
*/
|
||||
get maps() {
|
||||
return this._maps
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the active key.
|
||||
*
|
||||
* @member {string}
|
||||
* @readonly
|
||||
* @memberof MapList
|
||||
*/
|
||||
get active() {
|
||||
return this._active
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects the next map in the map array.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user