Only display annotations of first task

pull/1654/head
Piero Toffanin 2025-04-15 17:44:41 -04:00
rodzic 272467e327
commit 9e474ab217
3 zmienionych plików z 14 dodań i 5 usunięć

Wyświetl plik

@ -15,7 +15,7 @@ class AnnotationLayer extends React.Component{
super(props);
this.state = {
visible: !!props.layer._map
visible: true // !!props.layer._map
}
}

Wyświetl plik

@ -49,7 +49,7 @@ export default class LayersControlPanel extends React.Component {
const scanGroup = destination => {
return l => {
const meta = l[Symbol.for("meta")];
if (meta.task && meta.task.id) zIndexGroupMap[meta.task.id] = meta.zIndexGroup || 0;
if (meta.task && meta.task.id) zIndexGroupMap[meta.task.id] = meta.zIndexGroup || 1;
const group = meta.group;
if (group){
@ -99,8 +99,8 @@ export default class LayersControlPanel extends React.Component {
content = (<div>{getGroupContent(main)}
{Object.keys(groups).sort((a, b) => {
const za = zIndexGroupMap[a] || 0;
const zb = zIndexGroupMap[b] || 0;
const za = zIndexGroupMap[a] || 1;
const zb = zIndexGroupMap[b] || 1;
return za > zb ? -1 : 1;
}).map(id => {
return (<div key={id}>

Wyświetl plik

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