OdinMenuTree | Mimic right click behaviour from Hierarchy/Project View

Issue #322 open
Romain Pechot created an issue

Current State:

  • At the moment if you right click on an OdinMenuItem it will start the callback OdinMenuItem.OnRightClick but won't change your selection.
  • You also cannot right click on the available empty space at the end of a OdinMenuTree Editor.

New State:

  • Add a callback OnRightClick inside OdinMenuTree is triggered when a right click occurs inside the menu tree.
  • If you right click on a selected element it won't change your selection.
  • If you right click on a non-selected element it will be the new selection.
  • If you right click on an empty space (at the end of the menu tree) it won't change your selection.

Comments (2)

  1. Bjarke Elias
    • changed status to open

    Problem is, that if I add add that behavior, then, if you want the opposite, where you don't want right-click to select the item, then it becomes a little difficult.

    Right now you can easily do it throught the OnRightClick event just by doing

    if !(menuItem.IsSelected) menuItem.Select();
    

    inside the right-click event.

    What would the expected behavior be for right-clicking on empty space at the end of the OdinMenuTree btw? Do we swallow right click events preventing you from adding custom right-click logic or?

  2. Romain Pechot reporter

    Didn't thought of your solution for the OdinMenuItem, it should do the trick 😄

    For the empty space right click event, are you suggesting that we can already implement a contextual menu ? I suggest it to follow the logic of the OdinMenuItem.OnRightClick but maybe I didn't think it through 😅

  3. Log in to comment