GraphView: Cannot get ManipulatorActivationFilter to work

Hi,

i try to remap showing a context menu from RMB to LMB, seems to be easy but doesn’t work :slight_smile: Do i miss anything in this code snippet?

node.blendModeButton = new Button();
node.blendModeButton.AddManipulator(new ContextualMenuManipulator(node.ContextMenuDelegate));
node.blendModeButton.clickable.activators.Clear();
node.blendModeButton.clickable.activators.Add(new ManipulatorActivationFilter { button = MouseButton.LeftMouse });

By not working, do you mean that it still activates using RMB, or that it doesn’t activate at all anymore?

It still activates using RMB. And does not activate using LMB.

Ah, I see now. You are changing the activators on the wrong manipulator. blendModeButton.clickable is not the manipulator you just added with AddManipulator(). clickable is the button’s built-in Click manipulator. This is more what you need to do:

node.blendModeButton = new Button();

var manip = new ContextualMenuManipulator(node.ContextMenuDelegate);
manip.activators.Clear();
manip.activators.Add(new ManipulatorActivationFilter { button = MouseButton.LeftMouse });

node.blendModeButton.AddManipulator(manip);
1 Like

Worked, thanks! I really like this new GraphView :slight_smile: