Change layerChanged event trigger strategy

This commit is contained in:
Xen0Xys
2024-07-16 17:03:54 +02:00
committed by Matthieu Baumann
parent 609b78dda3
commit ba85bb496d
3 changed files with 13 additions and 5 deletions

View File

@@ -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();

View File

@@ -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();

View File

@@ -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);
})
}