Фикс табов слоев

This commit is contained in:
zakhy 2025-04-16 10:39:55 +07:00
parent e569e0fa7d
commit 17c8469686

View File

@ -118,7 +118,8 @@
<div class="row">
<div class="col-5 col-sm-3">
<div id="vert-tabs-tab"
role="tablist" aria-orientation="vertical" class="nav nav-pills">
role="tablist" aria-orientation="vertical"
class="nav nav-pills">
</div>
</div>
<div class="col-7 col-sm-9">
@ -533,7 +534,7 @@
}
// Функция для создания формы на основе свойств стиля
function createStyleForm(feature, layerName = "0") {
function createStyleForm(feature, layerName = "0", sinlgeLayer = false) {
// Список свойств стиля для отображения в форме
const styleProperties = Object.keys(DEFAULT_STYLE);
const style = feature.get("style") || DEFAULT_STYLE; // Используем стиль из фичи или по умолчанию
@ -553,6 +554,9 @@
tabLink.setAttribute('aria-controls', `layer_${layerName}`)
tabLink.ariaSelected = 'false'
tabLink.textContent = `Слой ${layerName}`
if (sinlgeLayer) {
tabLink.classList.add("active")
}
tabList.appendChild(tabLink)
@ -562,7 +566,10 @@
tabPane.className = 'tab-pane text-left fade'
tabPane.id = `layer_${layerName}`
tabPane.role = 'tabpanel'
tabPane.ariaLabelledBy = `layer_${layerName}-tab`
tabPane.setAttribute("aria-labelledby", `layer_${layerName}-tab`)
if (sinlgeLayer) {
tabPane.classList.add("active", "show")
}
const row = document.createElement('div')
row.className = 'row'
@ -655,7 +662,8 @@
}
if (features.length > 0) {
const firstFeature = features[0];
createStyleForm(firstFeature, firstFeature.get('layer'));
console.log(firstFeature, firstFeature.get('layer'))
createStyleForm(firstFeature, firstFeature.get('layer'), true);
}
}