-
Is it possible to listen to specific attribute change via https://resources.jointjs.com/docs/jointjs/v3.5/joint.html#dia.Element.events Right not it does not seem to work and the only possibility is to listen to the whole If it is not possible to pinpoint specific attribute, how can I track changes of specific attributes. I tried adding a property to my custom element class, saving specific attributes in there and comparing them by getting the export namespace app
export class Slot extends joint.shapes.standard.Polyline {
changed = { iconColor: null };
constructor() {
super();
this.on('change:attrs', function (element, attrs) {
let iconColor = (element as app.Slot).attr('slotIcon/iconColor');
if (iconColor != element.changed.iconColor) {
console.log(`change ${element.changed.iconColor} to ${iconColor}`);
element.changed.iconColor = iconColor;
}
});
}
//rest of the class
}
//rest of code
} I have also tried using an arrow function and My ultimate goal is to only react to specific attribute changes, because I need to perform and action on those changes that will change other attribute/custom data of the element and will effect the rendered element, thus optimizing performance is needed Listening to inspector events |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Changing the property Is there a better way, something like |
Beta Was this translation helpful? Give feedback.
Changing the property
changed
tochangedData
allows me to track changes, aschanged
is a reserved property handled by jointjs.Is there a better way, something like
change:[path to the changed property]
but ondia.Element
class ?