OrbitControl dragging error after leaving canvas

This is just a way for us to set extra data on the canvas component - since we dont control it we have a system to create little “Additional Data” components for unity. They dont exist at runtime, they are just used to set values on other components. In this case the “Canvas” component

You can add a little extra script that listens to onPointerEnter and onPointerExit (you can implement the IPointerEventHandler) and add it to the same object with the button

I found this solution :
if (this.mainContent) {
const originalOnPointerEnter = this.mainContent.onPointerEnter; // Conservez l’original

        this.mainContent.onPointerEnter = (...args) => {
        // Exécutez d'abord la fonction originale
        if (originalOnPointerEnter) {
            originalOnPointerEnter.apply(this.mainContent, args);
        }
    
        // Ensuite, exécutez votre callback
        this.onButtonClicked();
        };
    }

by user 224464722878005248