mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2026-01-07 02:24:59 -08:00
✨ Change layerChanged event trigger strategy
This commit is contained in:
committed by
Matthieu Baumann
parent
609b78dda3
commit
ba85bb496d
@@ -60,8 +60,8 @@
|
||||
console.log(proj)
|
||||
});
|
||||
|
||||
aladin.on('layerChanged', function(imageLayer, layer){
|
||||
console.log(imageLayer, layer)
|
||||
aladin.on('layerChanged', function(imageLayer, layer, state){
|
||||
console.log(imageLayer, layer, state)
|
||||
});
|
||||
|
||||
cat.sources[0].actionClicked();
|
||||
|
||||
@@ -286,6 +286,17 @@ export let Aladin = (function () {
|
||||
|
||||
const self = this;
|
||||
|
||||
ALEvent.HIPS_LAYER_ADDED.listenedBy(aladinDiv, (imageLayer) => {
|
||||
this.callbacksByEventName["layerChanged"] &&
|
||||
this.callbacksByEventName["layerChanged"](imageLayer.detail.layer, imageLayer.detail.layer.layer, "ADDED");
|
||||
});
|
||||
|
||||
ALEvent.HIPS_LAYER_REMOVED.listenedBy(aladinDiv, (imageLayer) => {
|
||||
console.log(imageLayer)
|
||||
this.callbacksByEventName["layerChanged"] &&
|
||||
this.callbacksByEventName["layerChanged"](imageLayer.detail.layer, imageLayer.detail.layer.layer, "REMOVED");
|
||||
});
|
||||
|
||||
// if not options was set, try to retrieve them from the query string
|
||||
if (requestedOptions === undefined) {
|
||||
requestedOptions = this.getOptionsFromQueryString();
|
||||
|
||||
@@ -1763,9 +1763,6 @@ export let View = (function () {
|
||||
self.renameLayer(this.overlayLayers[0], "base");
|
||||
}
|
||||
}
|
||||
|
||||
const layerChangedFn = this.aladin.callbacksByEventName["layerChanged"];
|
||||
(typeof layerChangedFn === "function") && layerChangedFn(imageLayer, layer);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user