change scale image size when clicked

hi to all
i want change the image size when i click and when click to another image , other image back to normal size . i can change the size but cant back to notmal size.

i uploud the photos

(sorry for bad english)
public class InventorySlot : MonoBehaviour,IPointerUpHandler,IPointerClickHandler {

     public Image icon;
   
     public void OnPointerClick(PointerEventData eventData)
     {
         if (Inventory.instance.itemList[transform.GetSiblingIndex()] != null) 
         {
             Inventory.instance.inventorySlots[transform.GetSiblingIndex()].icon.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); 
            
            
         }
     }

Photo _01

Photo _02

Hi there,

You should check if your actual scale is 1 or 1.5, before changing the scale.

What i mean is: If you click an image, then if that image is small (its scale = 1), set its scale to 1.5, but if your image is big (its scale = 1.5), then set its scale back to 1.

public void OnPointerClick(PointerEventData eventData)
    {
        if (Inventory.instance.itemList[transform.GetSiblingIndex()] != null)
        {
            if (Inventory.instance.inventorySlots[transform.GetSiblingIndex()].icon.transform.localScale.Equals(new Vector3(1.5f, 1.5f, 1.5f)))
                Inventory.instance.inventorySlots[transform.GetSiblingIndex()].icon.transform.localScale = Vector3.one;
            else
                Inventory.instance.inventorySlots[transform.GetSiblingIndex()].icon.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);

        }
    }

Hope it helps.