fix double statustext/tooltip

This commit is contained in:
ralf 2024-09-06 13:05:37 +02:00
parent da4efca4ec
commit a99a595258

View File

@ -68,10 +68,6 @@ export class Et2Image extends Et2Widget(LitElement) implements et2_IDetachedDOM
if (bootstrap && !this._img) if (bootstrap && !this._img)
{ {
this.className = 'bi-'+bootstrap[1]; this.className = 'bi-'+bootstrap[1];
if (this.statustext || this.label)
{
this.title = this.statustext || this.label;
}
return; return;
} }
// change between bootstrap and regular img // change between bootstrap and regular img
@ -172,18 +168,16 @@ export class Et2Image extends Et2Widget(LitElement) implements et2_IDetachedDOM
if (bootstrap) if (bootstrap)
{ {
this.className = 'bi-'+bootstrap[1]; this.className = 'bi-'+bootstrap[1];
this.title = this.statustext || this.label;
return html``; return html``;
} }
this.className = ''; this.className = '';
return html` return html`
<img ${this.id ? html`id="${this.id}"` : ''} <img ${this.id ? html`id="${this.id}"` : ''}
src="${url}" src="${url}"
alt="${this.label}" alt="${this.label || this.statustext}"
style="${this.height ? 'height: 100%; width: auto' : 'width: 100%; height: auto'}" style="${this.height ? 'height: 100%; width: auto' : 'width: 100%; height: auto'}"
part="image" part="image"
loading="lazy" loading="lazy"
title="${this.statustext || this.label}"
>`; >`;
} }
@ -244,7 +238,8 @@ export class Et2Image extends Et2Widget(LitElement) implements et2_IDetachedDOM
} }
for(const changedPropertiesKey in changedProperties) for(const changedPropertiesKey in changedProperties)
{ {
if(Et2Image.getPropertyOptions()[changedPropertiesKey]) if(Et2Image.getPropertyOptions()[changedPropertiesKey] &&
!(changedPropertiesKey === 'label' || changedPropertiesKey === 'statustext'))
{ {
this._img[changedPropertiesKey] = this[changedPropertiesKey]; this._img[changedPropertiesKey] = this[changedPropertiesKey];
} }