Fyrox icon indicating copy to clipboard operation
Fyrox copied to clipboard

Add context menu for scene entries in the editor

Open mrDIMAS opened this issue 8 months ago • 7 comments

The new context menu should appear when right-clicking on scene entry in the scene preview window:

Image

The context menu should contain the following option:

  • Show in Explorer - shows the scene file in standard OS file browser
  • Close - closes the current scene
  • Close all tabs - closes all scenes at once

mrDIMAS avatar Jul 16 '25 17:07 mrDIMAS

Picking this. Work in progress.

also for unsaved new scenes, ideally there shouldn't be a Show Explorer option right?

alwinsDen avatar Oct 24 '25 19:10 alwinsDen

@mrDIMAS I have created context menu, but I am not able to figure out how to trigger them on right click on tab. Have tried checking out exiting components but none have been helpful. Some input would be appreciated!

alwinsDen avatar Nov 24 '25 13:11 alwinsDen

.with_context_menu when creating tabs should be enough

mrDIMAS avatar Nov 24 '25 15:11 mrDIMAS

Tab appears to be an instance of ButtonBuilder, doesn't seem like it supports .with_context_menu

some gap in my understanding?

seems like the right-clicks on tab might be getting overridden by Button's default behaviour.

alwinsDen avatar Nov 25 '25 07:11 alwinsDen

Right, then you can add the context menu to TabDefinition (context_menu: Option<RcUiNodeHandle>) then and handle it in the TabControl by passing context_menu to Header::build and calling .with_context_menu on WidgetBuilder of ButtonBuilder.

mrDIMAS avatar Nov 25 '25 10:11 mrDIMAS

Have done exactly the same!

but right click isn't opening up the context menu.

please check this out: https://github.com/alwinsDen/Fyrox/pull/1/files#diff-692d1fcda147999f5580f747d9db80d492e937ebd0b71cc98c3c141e360ed22bR539

If I pass the same context menu to a content of TabDefinition inside a WidgetBuilder it works (e.g TextBuilder). So don't think issue is with the menus itself.

alwinsDen avatar Nov 25 '25 10:11 alwinsDen

The issue is that Button widget marks MouseUp event as handled and the context menu handling routine ignores such events. For some reason Button widget can be pressed by any mouse button, but it should only be pressable by left mouse button. I'll fix this today and your code should work after my change.

mrDIMAS avatar Nov 25 '25 16:11 mrDIMAS