Add stored flag for addAnnotation

pull/1654/head
Piero Toffanin 2025-04-16 01:38:34 -04:00
rodzic 1ba5e84d23
commit cc1e8a6248
1 zmienionych plików z 8 dodań i 6 usunięć

Wyświetl plik

@ -865,22 +865,24 @@ _('Example:'),
}); });
} }
handleAddAnnotation = (layer, name, task) => { handleAddAnnotation = (layer, name, task, stored) => {
const zIndexGroup = this.zIndexGroupMap[task.id] || 1; const zIndexGroup = this.zIndexGroupMap[task.id] || 1;
const meta = { const meta = {
name: name || "", name: name || "",
icon: "fa fa-sticky-note fa-fw", icon: "fa fa-sticky-note fa-fw",
zIndexGroup, zIndexGroup
}; };
if (this.taskCount > 1 && task){ if (this.taskCount > 1 && task){
meta.group = {id: task.id, name: task.name}; meta.group = {id: task.id, name: task.name};
// Only show annotations for the first task if (stored){
let maxZIndex = Math.max(...Object.values(this.zIndexGroupMap)) || 1; // Only show annotations for the first task
if (zIndexGroup !== maxZIndex){ let maxZIndex = Math.max(...Object.values(this.zIndexGroupMap)) || 1;
PluginsAPI.Map.toggleAnnotation(layer, false); if (zIndexGroup !== maxZIndex){
PluginsAPI.Map.toggleAnnotation(layer, false);
}
} }
} }
layer[Symbol.for("meta")] = meta; layer[Symbol.for("meta")] = meta;