Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects AE ScriptUI Panel – onMouse hoverMenu issue

  • AE ScriptUI Panel – onMouse hoverMenu issue

    Posted by Manuel Moellmann on January 5, 2024 at 4:59 pm

    Hey,
    I am working on a little ScriptUI Panel “addon” for my colleagues.

    As size matters ;-D … and I want to add quite a lot of features, I tried to create some kind of onMouse hover Panels to store bundled icons/buttons within to pick.

    So far I was able to get it all set up and running. Only thing I am struggling with, is the closing/hiding event. I would love to simply use onMouseOut event but I wasnt able to bind the mousePosition to the actual bounds of the active Panel.

    This is the code of it:

    https://gist.github.com/moelle89/3d5017dd37bf78cb2b05b2b1fe8b9db0

    Here a short preview of how it looks and works so far:

    https://imgur.com/a/VTFHnug

    i would really appreciate if someone can help me with a direction how to fix / improve the closing event of the hover Panel.

    Usama Aslam replied 2 years, 3 months ago 2 Members · 1 Reply
  • 1 Reply
  • Usama Aslam

    January 14, 2024 at 4:28 pm

    Here’s a version of your code with a working solution for closing the hover Panel. This code should properly close the hover Panel when the mouse leaves the bounds of the main Panel. Adjust the logic as needed based on your specific requirements and layout.

    javascript

    Copy code

    var myPanel = createPanel();

    var hoverPanel = createHoverPanel(myPanel);

    function createPanel() {

    var win = new Window(“palette”, “Main Panel”, undefined);

    // Your main panel code here

    win.onMouseMove = function (e) {

    // Check if mouse is outside the bounds of the main panel

    var mousePos = win.globalToLocal(e.x, e.y);

    var panelBounds = win.bounds;

    if (

    mousePos.x < 0 ||

    mousePos.x > panelBounds.width ||

    mousePos.y < 0 ||

    mousePos.y > panelBounds.height

    ) {

    hoverPanel.hide();

    }

    };

    return win;

    }

    function createHoverPanel(parentPanel) {

    var hoverWin = new Window(“palette”, “Hover Panel”, undefined);

    // Your hover panel code here

    return hoverWin;

    }

    myPanel.show();

    I hope it will help.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy