feat: add title attribute to layers in browser (#2489)
Some checks are pending
Test & Docs / tests (postgresql, 3.10) (push) Waiting to run
Test & Docs / tests (postgresql, 3.12) (push) Waiting to run
Test & Docs / lint (push) Waiting to run
Test & Docs / docs (push) Waiting to run

Usefull when the layer title is truncated because too long.


![image](https://github.com/user-attachments/assets/267a4639-e929-4be9-8934-373afb24b6fe)


![image](https://github.com/user-attachments/assets/0c8953df-77a5-4b7f-93b3-92bf9d7894ff)
This commit is contained in:
Yohan Boniface 2025-02-10 17:17:55 +01:00 committed by GitHub
commit aea422a247
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -46,7 +46,7 @@ export default class Browser {
const symbol = feature._getIconUrl const symbol = feature._getIconUrl
? Icon.formatUrl(feature._getIconUrl(), feature) ? Icon.formatUrl(feature._getIconUrl(), feature)
: null : null
title.textContent = feature.getDisplayName() || '—' title.textContent = title.title = feature.getDisplayName() || '—'
const bgcolor = feature.getPreviewColor() const bgcolor = feature.getPreviewColor()
colorBox.style.backgroundColor = bgcolor colorBox.style.backgroundColor = bgcolor
if (symbol && symbol !== U.SCHEMA.iconUrl.default) { if (symbol && symbol !== U.SCHEMA.iconUrl.default) {
@ -97,7 +97,7 @@ export default class Browser {
DomEvent.on(toggle, 'click', toggleList) DomEvent.on(toggle, 'click', toggleList)
datalayer.renderToolbox(headline) datalayer.renderToolbox(headline)
const name = DomUtil.create('span', 'datalayer-name', headline) const name = DomUtil.create('span', 'datalayer-name', headline)
name.textContent = datalayer.options.name name.textContent = name.title = datalayer.options.name
DomEvent.on(name, 'click', toggleList) DomEvent.on(name, 'click', toggleList)
container.innerHTML = '' container.innerHTML = ''
datalayer.eachFeature((feature) => this.addFeature(feature, container)) datalayer.eachFeature((feature) => this.addFeature(feature, container))