UI: Improve SCADA symbol icon function.
This commit is contained in:
parent
b5e898a397
commit
d993b01638
@ -883,9 +883,19 @@ export class ScadaSymbolObject {
|
|||||||
center = true) {
|
center = true) {
|
||||||
this.elements(e).forEach(element => {
|
this.elements(e).forEach(element => {
|
||||||
if (element.type === 'g') {
|
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();
|
element.clear();
|
||||||
this.createIconElement(icon, size, color).subscribe((iconElement) => {
|
this.createIconElement(icon, size, color).subscribe((iconElement) => {
|
||||||
if (iconElement) {
|
if (iconElement) {
|
||||||
|
iconElement.remember('iconData', {icon, size, color});
|
||||||
element.add(iconElement);
|
element.add(iconElement);
|
||||||
if (center) {
|
if (center) {
|
||||||
const box = iconElement.bbox();
|
const box = iconElement.bbox();
|
||||||
@ -894,6 +904,7 @@ export class ScadaSymbolObject {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user