Change Adornment fill dynamicly

Hi,

I have an adornment that I add to a node dynamically.
On mouse enter I show the adornment and on mouse leave I hide it.
Depending on the data of the node I want to change the look of the adornment.

Notice I have icons with a gray background and some with white background.
Since the data is changed outside the model of the node I am evaluating the node’s data on mouse enter and mouse leave events and changing the background as needed.
This is the code:

let toggleActionIcons = function(shouldShow){
        actionIconsNames.forEach(function(v){
          for(let adIt = obj.adornments; adIt.next();){
            let icon = adIt.value.findObject(v);
            let shape = adIt.value.findObject('AdorShape');
            if (shape) {
              shape.fill = obj.data[v] ? '#747474' : '#ffffff';
            }
            if(icon){
              if(obj.data[v]){
                icon.visible = true;
              }else{
                icon.visible = shouldShow;
              }
            }

          }
        });
      };

My problem is that changing to visible property of the icons works perfectly but changing the fill property does not work at all.
What am I doing wrong here ?

Thanks,
Oren

You need to step through the code to debug it.

Does findObject('AdorShape') actually return a Shape?

Yes, findObject is finding the correct object.

I don’t know what to say, since I don’t know your templates and cannot debug your app for you. Your code looks fine to me given the very limited knowledge I have of your app.

How do you know that the call to findObject('AdorShape') really is returning the Shape that is the background for the icon that you are seeing? Or is it even supposed to be the background Shape for the icon? How is the icon represented? How did you initially get some of them to have a white background and some with a gray background?