Sliding interface

  • #1, by dror-ben-hurSaturday, 16. June 2018, 13:16 6 years ago
    Hi all,
    I have implemented A slinding interface (inventory) using this code:
    I have a button with:
    "On Cursor enters button area":
    local pos = Interfaces["Main"].InterfaceOffset
    if pos.y == -95 then 
     Interfaces["Main"]:to(1000, {InterfaceOffset = {x=pos.x,y=0}}, easeQuintIn)
    end

    And "On Cursor leaves button area":
    local pos = Interfaces["Main"].InterfaceOffset
    if pos.y == 0 then 
     Interfaces["Main"]:to(1000, {InterfaceOffset = {x=pos.x, y=-95}}, easeQuintIn)
    end

    My problem is: 
    In the inventory I have some more  buttons (placeholder for items) whan the cursor is on one of them the "Cursor leaves button area" event is triggered and the interface is start to slideing.

    How can I solved it?

    Thought for solution: 
    In "Cursor enters/leaves button area", test if the cursor is over one of the interface buttons, if not continue. but what is the code for thet?

    Thank you!

    Newbie

    27 Posts


  • #2, by afrlmeSaturday, 16. June 2018, 15:21 6 years ago
    Add the on leave stuff into the "action on leaving" section under "properties" for the interface. You will need to specify the interface area, if you haven't already done so via the "create and edit interface area" button above the interface preview viewport & drawing around the interface.

    You might want to check out this sliding interface template I created the other week - it's for vs 5.x.

    Imperator

    7278 Posts

  • #3, by dror-ben-hurSaturday, 16. June 2018, 18:41 6 years ago
    Simple and easy.
    "action on leaving" section under "properties" for the interface
    Thank you!

    Newbie

    27 Posts

  • #4, by afrlmeSaturday, 16. June 2018, 19:48 6 years ago
    Did you check out the template I linked? It uses a bit of math to always make sure the interface speed remains constant even if you start or end the slide before it is done. I would recommend it if you are doing a mouse over/out type sliding interface.

    The absolute positioning method you have used works great for when you want to open & close an interface with the mouse wheel or an interface button or keyboard button.

    Imperator

    7278 Posts