UI: Improve SCADA symbol icon function.

This commit is contained in:
Igor Kulikov 2024-09-11 18:40:08 +03:00
parent b5e898a397
commit d993b01638

View File

@ -883,9 +883,19 @@ export class ScadaSymbolObject {
center = true) {
this.elements(e).forEach(element => {
if (element.type === 'g') {
let skip = false;
const firstChild = element.first();
if (firstChild) {
const iconData: {icon: string; size: number; color: string} = firstChild.remember('iconData');
if (iconData && iconData.icon === icon && iconData.size === size && iconData.color === color) {
skip = true;
}
}
if (!skip) {
element.clear();
this.createIconElement(icon, size, color).subscribe((iconElement) => {
if (iconElement) {
iconElement.remember('iconData', {icon, size, color});
element.add(iconElement);
if (center) {
const box = iconElement.bbox();
@ -894,6 +904,7 @@ export class ScadaSymbolObject {
}
});
}
}
});
}