include hipsList in options merge

This commit is contained in:
Patrick Custer
2025-02-27 14:31:43 -05:00
committed by Matthieu Baumann
parent 255f123652
commit 35f6037f7f

View File

@@ -306,10 +306,16 @@ export let Aladin = (function () {
var options = {
...Aladin.DEFAULT_OPTIONS,
...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:{
...Aladin.DEFAULT_OPTIONS.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;