mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2025-12-12 15:49:18 -08:00
include hipsList in options merge
This commit is contained in:
committed by
Matthieu Baumann
parent
255f123652
commit
35f6037f7f
@@ -306,10 +306,16 @@ export let Aladin = (function () {
|
|||||||
var options = {
|
var options = {
|
||||||
...Aladin.DEFAULT_OPTIONS,
|
...Aladin.DEFAULT_OPTIONS,
|
||||||
...requestedOptions,
|
...requestedOptions,
|
||||||
|
// In javascript, arrays like objects are copied by reference.
|
||||||
|
// To not change the default aladin options afterwards,
|
||||||
|
// we use the spread operator to create a new object for the gridOptions property
|
||||||
gridOptions:{
|
gridOptions:{
|
||||||
...Aladin.DEFAULT_OPTIONS.gridOptions,
|
...Aladin.DEFAULT_OPTIONS.gridOptions,
|
||||||
...requestedOptions.gridOptions
|
...requestedOptions.gridOptions
|
||||||
}
|
},
|
||||||
|
// and use the slice method to create a new array for the hipsList property:
|
||||||
|
// https://stackoverflow.com/questions/7486085/copy-array-by-value
|
||||||
|
hipsList: requestedOptions.hipsList || Aladin.DEFAULT_OPTIONS.hipsList.slice()
|
||||||
};
|
};
|
||||||
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
|||||||
Reference in New Issue
Block a user