Custom Alt+Click


How would you make a custom alt+click behavior for existing components?

I tried to solve it nicely with an AltClick invisible component which you just “attach” to any component to cover it and to override its “secondary click” behavior to run a given lambda but pass through all other mouse events. Sadly it didn’t work because some components like Button rely on Component::isMouseButtonDown which check whether a component is directly under the mouse (not counting sub-components).

  • How would you override secondary clicks? Should I use inheritance for that?
  • Should Component::isMouseButtonDown also check for mouse being on child components?

For reference here’s my attempt: